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

Android  Notification使用方法詳解

 更新時間:2017年05月25日 14:52:00   作者:宋錚  
這篇文章主要介紹了Android Notification使用詳解的相關(guān)資料,需要的朋友可以參考下

Android  Notification使用詳解

Notification

核心代碼(鏈式調(diào)用):適用于Android 4.0以上(不兼容低版本)

Notification noti = new Notification.Builder(this)
.setContentTitle("標題名稱")
.setContentText("標題里的內(nèi)容")
.setSmallIcon(R.drawable.new_mail)
.setLargeIcon(BitmapFactory.decordResource(getResources(), R.drawable.ic_launcher))
.build();

NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(0, noti);

兼容版本

Notification notification = new Notification(R.drawable.ic_launcher, "xxxxxx", System.currentTimeMillis());
//點擊事件真正想執(zhí)行的動作
Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:110"));
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(this, "標題", "內(nèi)容", contentIntent);
NotificationManager nm = (NotificationManager) getSystemManager(NOTIFICATION_SERVICE);
nm.notify(0, notification);

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論