我試圖從類似於Android文檔解釋的通知中啓動活動,但是當我打開通知然後按後退按鈕時,HomeActivity(父級)不會不開放,而是申請關閉。我究竟做錯了什麼?Android - 生成通知,TaskStackBuilder.addParentStack不工作
Intent resultIntent = new Intent(context, MatchActivity.class);;
resultIntent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(MainActivity.class);
stackBuilder.addNextIntent(resultIntent);
對於任何人想知道,公認的答案的作品,但resultIntent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)不存在在Android文檔。它給了我地獄。 – wsgeorge