本文整理汇总了Java中cn.sharesdk.framework.utils.UIHandler.sendMessageDelayed方法的典型用法代码示例。如果您正苦于以下问题:Java UIHandler.sendMessageDelayed方法的具体用法?Java UIHandler.sendMessageDelayed怎么用?Java UIHandler.sendMessageDelayed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.sharesdk.framework.utils.UIHandler
的用法示例。
在下文中一共展示了UIHandler.sendMessageDelayed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showNotification
import cn.sharesdk.framework.utils.UIHandler; //导入方法依赖的package包/类
private void showNotification(long cancelTime, String text) {
try {
Context app = getContext().getApplicationContext();
NotificationManager nm = (NotificationManager) app
.getSystemService(Context.NOTIFICATION_SERVICE);
final int id = Integer.MAX_VALUE / 13 + 1;
nm.cancel(id);
long when = System.currentTimeMillis();
Notification notification = new Notification(notifyIcon, text, when);
PendingIntent pi = PendingIntent.getActivity(app, 0, new Intent(), 0);
notification.setLatestEventInfo(app, notifyTitle, text, pi);
notification.flags = Notification.FLAG_AUTO_CANCEL;
nm.notify(id, notification);
if (cancelTime > 0) {
Message msg = new Message();
msg.what = MSG_CANCEL_NOTIFY;
msg.obj = nm;
msg.arg1 = id;
UIHandler.sendMessageDelayed(msg, cancelTime, this);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: showNotification
import cn.sharesdk.framework.utils.UIHandler; //导入方法依赖的package包/类
private void showNotification(long cancelTime, String text) {
try {
Context app = context.getApplicationContext();
NotificationManager nm = (NotificationManager) app
.getSystemService(Context.NOTIFICATION_SERVICE);
final int id = Integer.MAX_VALUE / 13 + 1;
nm.cancel(id);
long when = System.currentTimeMillis();
Notification notification = new Notification(notifyIcon, text, when);
PendingIntent pi = PendingIntent.getActivity(app, 0, new Intent(), 0);
notification.setLatestEventInfo(app, notifyTitle, text, pi);
notification.flags = Notification.FLAG_AUTO_CANCEL;
nm.notify(id, notification);
if (cancelTime > 0) {
Message msg = new Message();
msg.what = MSG_CANCEL_NOTIFY;
msg.obj = nm;
msg.arg1 = id;
UIHandler.sendMessageDelayed(msg, cancelTime, this);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: showNotification
import cn.sharesdk.framework.utils.UIHandler; //导入方法依赖的package包/类
private void showNotification(long cancelTime, String text) {
try {
Context app = getContext().getApplicationContext();
NotificationManager nm = (NotificationManager) app.getSystemService(Context.NOTIFICATION_SERVICE);
final int id = Integer.MAX_VALUE / 13 + 1;
nm.cancel(id);
long when = System.currentTimeMillis();
Notification notification = new Notification(notifyIcon, text, when);
PendingIntent pi = PendingIntent.getActivity(app, 0, new Intent(), 0);
notification.setLatestEventInfo(app, notifyTitle, text, pi);
notification.flags = Notification.FLAG_AUTO_CANCEL;
nm.notify(id, notification);
if (cancelTime > 0) {
Message msg = new Message();
msg.what = MSG_CANCEL_NOTIFY;
msg.obj = nm;
msg.arg1 = id;
UIHandler.sendMessageDelayed(msg, cancelTime, this);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: showNotification
import cn.sharesdk.framework.utils.UIHandler; //导入方法依赖的package包/类
private void showNotification(long cancelTime, String text) {
try {
Context app = getApplicationContext();
NotificationManager nm = (NotificationManager) app
.getSystemService(Context.NOTIFICATION_SERVICE);
final int id = Integer.MAX_VALUE / 13 + 1;
nm.cancel(id);
long when = System.currentTimeMillis();
Notification notification = new Notification(R.drawable.ic_launcher, text, when);
PendingIntent pi = PendingIntent.getActivity(app, 0, new Intent(), 0);
notification.setLatestEventInfo(app, "sharesdk test", text, pi);
notification.flags = Notification.FLAG_AUTO_CANCEL;
nm.notify(id, notification);
if (cancelTime > 0) {
Message msg = new Message();
msg.what = MSG_CANCEL_NOTIFY;
msg.obj = nm;
msg.arg1 = id;
UIHandler.sendMessageDelayed(msg, cancelTime, this);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: showNotification
import cn.sharesdk.framework.utils.UIHandler; //导入方法依赖的package包/类
private void showNotification(long cancelTime, String text) {
try {
Context app = getContext().getApplicationContext();
NotificationManager nm = (NotificationManager) app
.getSystemService(Context.NOTIFICATION_SERVICE);
final int id = Integer.MAX_VALUE / 13 + 1;
nm.cancel(id);
long when = System.currentTimeMillis();
Notification notification = new Notification(notifyIcon, text, when);
PendingIntent pi = PendingIntent.getActivity(app, 0, new Intent(), 0);
notification.setLatestEventInfo(app, notifyTitle, text, pi);
notification.flags = Notification.FLAG_AUTO_CANCEL;
nm.notify(id, notification);
if (cancelTime > 0) {
Message msg = new Message();
msg.what = MSG_CANCEL_NOTIFY;
msg.obj = nm;
msg.arg1 = id;
UIHandler.sendMessageDelayed(msg, cancelTime, this);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: showNotification
import cn.sharesdk.framework.utils.UIHandler; //导入方法依赖的package包/类
private void showNotification(long cancelTime, String text) {
try {
Context app = getContext().getApplicationContext();
NotificationManager nm = (NotificationManager) app
.getSystemService(Context.NOTIFICATION_SERVICE);
final int id = Integer.MAX_VALUE / 13 + 1;
nm.cancel(id);
long when = System.currentTimeMillis();
PendingIntent pi = PendingIntent.getActivity(app, 0, new Intent(), 0);
Builder builder = new Notification.Builder(app);
builder.setSmallIcon(notifyIcon);
builder.setContentTitle(notifyTitle);
builder.setTicker(text);
builder.setContentInfo(text);
builder.setContentText(text);
builder.setWhen(when);
builder.setContentIntent(pi);
Notification notification = builder.build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
nm.notify(id, notification);
if (cancelTime > 0) {
Message msg = new Message();
msg.what = MSG_CANCEL_NOTIFY;
msg.obj = nm;
msg.arg1 = id;
UIHandler.sendMessageDelayed(msg, cancelTime, this);
}
} catch (Exception e) {
e.printStackTrace();
}
}