当前位置: 首页>>代码示例>>Java>>正文


Java UIHandler.sendMessageDelayed方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:27,代码来源:OnekeyShare.java

示例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();
	}
}
 
开发者ID:nickalc,项目名称:csdn-master,代码行数:27,代码来源:OnekeyShare.java

示例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();
    }
}
 
开发者ID:csuyzb,项目名称:AndroidLinkup,代码行数:26,代码来源:OnekeyShare.java

示例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();
	}
}
 
开发者ID:MobClub,项目名称:Android_ShareSDK_Example_OnekeyShare,代码行数:27,代码来源:MainActivity.java

示例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();
	}
}
 
开发者ID:MobClub,项目名称:android_demo_cocos2d-x_plugin-x,代码行数:27,代码来源:OnekeyShare.java

示例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();
	}
}
 
开发者ID:SimonJoker,项目名称:OnTheRoad,代码行数:36,代码来源:OnekeyShare.java


注:本文中的cn.sharesdk.framework.utils.UIHandler.sendMessageDelayed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。