通知を閉じるには、ユーザーがクリックした後に終了します。誰もがフラグを使用すると言っているのを見ましたが、通知クラスではなくNotificationCompat.Builderクラスを使用しているため、どこでもフラグを見つけることができません。誰かが自分自身で通知を取り除く方法を知っていますか?クリックした後で通知を削除する
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());
ここでフラグを追加しますか?私のコードで私を見せてもらえますか? –
通知オブジェクトの通知フラグに追加します。 – JoxTraex