我希望在用户点击通知后关闭通知。我看到每个人都说使用标志,但是我无法在任何地方找到标志,因为我使用的是NotificationCompat.Builder类而不是Notification类。有人有任何想法如何使她的自我消除通知?
下面是当我设置的通知我的代码:点击后删除通知
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("New Question")
.setContentText("" + QuestionData.getAuthor().getUserName() + ": " + QuestionData.getQuestion() + "");
Intent openHomePageActivity = new Intent("com.example.ihelp.HOMEPAGEACTIVITY");
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addNextIntent(openHomePageActivity);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, mBuilder.build());
我在哪里添加标志?你可以在我的代码中显示我吗? – 2013-02-27 19:49:40
将它添加到您的通知对象的通知标志。 – JoxTraex 2013-02-27 19:54:19