クリックするとアプリケーションにメッセージが表示され、ユーザーが戻るボタンをクリックするとメイン画面に戻るという通知を作成しようとしています。
問題は、現在、新しいインスタンスが作成され、以前のデータがすべて失われることです。私は何を間違っていますか?
NotificationManager nm = (NotificationManager) getSystemService("notification");
Intent intent = new Intent(this, beerwarn.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(beerwarn.class);
stackBuilder.addNextIntent(intent);
PendingIntent pIntent = stackBuilder.getPendingIntent
(0, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setContentIntent(pIntent)
//Notification noti = new Notification.Builder(this)
.setContentTitle("BAC Level Notice")
.setContentText("Your BAC has dropped below Max Legal BAC")
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pIntent)
.setSmallIcon(R.drawable.beerwarn);
//builder.flags |= Notification.FLAG_AUTO_CANCEL;
nm.notify(1, builder.build());