亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

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

用通知欄來提醒

public void notifyKJ() {
 //獲得通知管理器,通知是一項系統(tǒng)服務
 NotificationManager manager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
 //初始化通知對象 p1:通知的圖標 p2:通知的狀態(tài)欄顯示的提示 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);
}

自動跳轉到網(wǎng)絡設置界面

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

希望本文所述對大家Android程序設計有所幫助。

相關文章

最新評論