Dies ist nicht korrekt! Wenn Sie aus der Meldung beginnen müssen Sie den Stapel erstellen, wenn die Meldung Aufbau wie hier erklärt: http://developer.android.com/guide/topics/ui/notifiers/notifications.html#NotificationResponse
Deshalb, wenn die Benachrichtigung Erstellen Sie, dies zu tun haben:
Intent resultIntent = new Intent(this, ResultActivity.class);
// ResultActivity is the activity you'll land on, of course
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack
stackBuilder.addParentStack(ResultActivity.class);
// Adds the Intent to the top of the stack
// make sure that in the manifest ResultActivity has parent specified!!!
stackBuilder.addNextIntent(resultIntent);
// Gets a PendingIntent containing the entire back stack
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
und dann, wenn Sie Klicken Sie auf die Schaltfläche AUF, Sie benötigen den regulären Code, der lautet:
if (NavUtils.shouldUpRecreateTask(this, intent)) {
// This activity is NOT part of this app's task, so
// create a new task when navigating up, with a
// synthesized back stack.
TaskStackBuilder.create(this)
// Add all of this activity's parents to the back stack
.addNextIntentWithParentStack(intent)
// Navigate up to the closest parent
.startActivities();
} else {
NavUtils.navigateUpTo(this, intent);
}
Dies funktioniert perfekt für mich.
Hallo Clyde, funktioniert shouldUpRecreateTask für Sie vor Jellybean? Ich werde immer falsch auf dem Emulator, egal ob ich meine App direkt vor dem Öffnen der Benachrichtigung getötet habe. – Maragues
Ich habe eigentlich genau das gleiche Problem. AFAIK, es scheint kaputt zu sein. –
Siehe http://stackoverflow.com/questions/14602283/up-navigation-broken-on-jellybean – riwnodennyk