進行中のファイルダイアログをダウンロードするアクティビティがあります。また、ユーザーがボタン「非表示」を押すと、通知が作成され、進行状況ダイアログが非表示になります。また、ユーザーが通知をクリックすると、アクティビティに進行状況ダイアログが表示されます。「戻る」ボタンを押したときに、アクティビティを戻るタスクに切り替えるにはどうすればよいですか?
質問する
12274 次
2 に答える
6
アクティビティを破棄しない場合は、アクティビティ起動モードをに設定しsingle_instance
、を使用moveTaskToBack(true)
してバックグラウンドに送信する必要があります。
于 2013-10-22T23:36:15.850 に答える
2
あなたがする必要があるのは、スタックからfinish()
を削除するために呼び出すことです。Activity
次に、通知で、Activity
クリックしたときに呼び出される名前を次のように設定します。
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon,
"A new notification", System.currentTimeMillis());
// Specify the called Activity
Intent intent = new Intent(this, YourActivityName.class);
intent.putBoolean("isDownloading", true); // check this value in Activity
PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0);
notification.setLatestEventInfo(this, "This is the title",
"This is the text", activity);
notificationManager.notify(0, notification);
于 2012-09-21T04:19:40.597 に答える