Notification.Builder nb = new Notification.Builder(MyService.this);
nb.setSmallIcon(R.drawable.qq);
nb.setContentInfo("ContentInfo");
nb.setContentTitle("ContentTitle");
nb.setContentText("ContentText");
Intent intent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,intent, PendingIntent.FLAG_UPDATE_CURRENT);
nb.setContentIntent(contentIntent);
Notification notification = nb.build();
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(1, notification);上面是我的代码,但是 一运行程序就奔溃,初学android 不知道 为啥?求给个能运行的Notification.Builder 产生 Notification 的例子?AndroidNotification.BuilderNotification
nb.setSmallIcon(R.drawable.qq);
nb.setContentInfo("ContentInfo");
nb.setContentTitle("ContentTitle");
nb.setContentText("ContentText");
Intent intent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,intent, PendingIntent.FLAG_UPDATE_CURRENT);
nb.setContentIntent(contentIntent);
Notification notification = nb.build();
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(1, notification);上面是我的代码,但是 一运行程序就奔溃,初学android 不知道 为啥?求给个能运行的Notification.Builder 产生 Notification 的例子?AndroidNotification.BuilderNotification
解决方案 »
- 编译pandaboard遇到错误
- 弄个按钮而已,报如下错误。在线等,急~
- 关于CursorAdapter,数据库关闭问题
- 不同activity之间传递SharedPreferences值(同一package中)
- Android 列出清单怎么实现?
- ListView中EditText的问题
- Theme.AppCompat.Light.DarkActionBar
- Android 做Launcher 项目,如何把状态栏设置透明?
- 1024x600分辨率的机器安装“全民K歌TV版”部分控件显示异常
- root后如何可防止被检测?
- 真机无法连接PC服务器端
- 求各位大侠帮帮忙,这个是什么意思?android.os.Build.VERSION_CODES.
我的手机是4.04 我看的 API 是17 .......... ,我的错 换个问题:
BitmapFactory.decodeFile("android.resource://com.octopus.paopao/raw/m1")但是得到 是空 Bitemap ? 为什么 ? 使用项目里面的 资源 decodeFile(UriString) 里面的URiString该怎么写?