欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android開發(fā)之使用通知欄顯示提醒信息的方法

 更新時(shí)間:2016年01月16日 09:18:31   作者:hshm20517  
這篇文章主要介紹了Android開發(fā)之使用通知欄顯示提醒信息的方法,涉及Notification的使用及通知欄信息設(shè)置技巧,需要的朋友可以參考下

本文實(shí)例講述了Android開發(fā)之使用通知欄顯示提醒信息的方法。分享給大家供大家參考,具體如下:

用通知欄來(lái)提醒

public void notifyKJ() {
 //獲得通知管理器,通知是一項(xiàng)系統(tǒng)服務(wù)
 NotificationManager manager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
 //初始化通知對(duì)象 p1:通知的圖標(biāo) p2:通知的狀態(tài)欄顯示的提示 p3:通知顯示的時(shí)間
 Notification notification = new Notification(R.drawable.kjalarm, "提醒", System.currentTimeMillis());
 //點(diǎn)擊通知后的Intent,此例子點(diǎn)擊后還是在當(dāng)前界面
 Intent descIntent = new Intent(context, com.acp.main.DesktopUI.class);
 descIntent.putExtra(DesktopUI.requestCode,DesktopUI.KJ);
 PendingIntent intent = PendingIntent.getActivity(context, 0, descIntent, 0);
 //設(shè)置通知信息
 notification.setLatestEventInfo(context, "提醒", "祝您天天快樂", intent);
 notification.flags|=Notification.FLAG_AUTO_CANCEL; //當(dāng)查看后,自動(dòng)消失
 notification.defaults |= Notification.DEFAULT_SOUND;//默認(rèn)聲音提示
 //通知
 manager.notify(NOTICE_ID, notification);
}

自動(dòng)跳轉(zhuǎn)到網(wǎng)絡(luò)設(shè)置界面

復(fù)制代碼 代碼如下:
context.startActivityForResult(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS),0);

希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論