国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android Notification使用方法詳解

2019-12-12 02:48:57
字體:
來源:轉載
供稿:網友

Android  Notification使用詳解

Notification

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

Notification noti = new Notification.Builder(this).setContentTitle("標題名稱").setContentText("標題里的內容").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());//點擊事件真正想執行的動作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, "標題", "內容", contentIntent);NotificationManager nm = (NotificationManager) getSystemManager(NOTIFICATION_SERVICE);nm.notify(0, notification);

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 岳池县| 江孜县| 卓尼县| 贵南县| 南康市| 东乡| 永安市| 两当县| 扎赉特旗| 城市| 涡阳县| 从江县| 桃园市| 台中县| 塔城市| 开化县| 乌拉特前旗| 会同县| 孟州市| 承德市| 丰原市| 锡林浩特市| 凌云县| 石首市| 梨树县| 沈丘县| 循化| 子长县| 卢龙县| 连城县| 共和县| 东兰县| 富源县| 阿坝县| 修文县| 古田县| 上犹县| 赤壁市| 尼玛县| 达尔| 阜城县|