我正在做一个应用程序,我正在使用通知。当我运行我的代码时,我可以看到标题栏上的通知图标,这是正常的,当我向下滑动并单击它时,它也打开了huhu类。我的问题是标题栏上总是看到图标。点击我想要图标消息的信息窗口。我该怎么办?
我的代码:
Intent openintent = new Intent(context,huhu.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence from = "Did you miss "+loglist.get(i).contactname+" ?";
CharSequence message = "You didnt call "+loglist.get(i).contactname+" Today";
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
openintent, 0);
Notification notif = new Notification(R.drawable.ic_launcher,
"Daily Call Reminder! ", System.currentTimeMillis());
notif.setLatestEventInfo(context, from, message, contentIntent);
nm.notify(1, notif);
答案 0 :(得分:0)
后
Notification notif = new Notification(R.drawable.ic_launcher,
"Daily Call Reminder! ", System.currentTimeMillis());
把
notif.flags |= Notification.FLAG_AUTO_CANCEL;