京东商城沙发床,汪嘉年,bemmart
本文实例讲述了android开发之使用通知栏显示提醒信息的方法。分享给大家供大家参考,具体如下:
用通知栏来提醒
public void notifykj() { //获得通知管理器,通知是一项系统服务 notificationmanager manager = (notificationmanager) context.getsystemservice(context.notification_service); //初始化通知对象 p1:通知的图标 p2:通知的状态栏显示的提示 p3:通知显示的时间 notification notification = new notification(r.drawable.kjalarm, "提醒", system.currenttimemillis()); //点击通知后的intent,此例子点击后还是在当前界面 intent descintent = new intent(context, com.acp.main.desktopui.class); descintent.putextra(desktopui.requestcode,desktopui.kj); pendingintent intent = pendingintent.getactivity(context, 0, descintent, 0); //设置通知信息 notification.setlatesteventinfo(context, "提醒", "祝您天天快乐", intent); notification.flags|=notification.flag_auto_cancel; //当查看后,自动消失 notification.defaults |= notification.default_sound;//默认声音提示 //通知 manager.notify(notice_id, notification); }
自动跳转到网络设置界面
希望本文所述对大家android程序设计有所帮助。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android apk 项目一键打包并上传到蒲公英的实现方法
Android 自定义LineLayout实现满屏任意拖动功能的示例代码
android 限制某个操作每天只能操作指定的次数(示例代码详解)
Android 集成 google 登录并获取性别等隐私信息的实现代码
网友评论