Wie hole ich eine bestimmte Aktivität wieder in den Vordergrund?

G

gurkenprinz

Neues Mitglied
0
Hallo!

In meiner App kann man durch eine vielzahl von aktivitäten navigieren. Dazu benutze ich eigentlich immer "startAcitivty(intent);". Dadurch entsteht ja ein ziemlich großer Stapel an Aktivitäten.

Wie kann ich eine bestimmte Aktivität aus diesem Stapel herausholen und wieder im Vordergrund anzeigen ? Denn durch "startActivity(intent)" wird sie ja neu geladen, was ja ziemlich sinnlos ist wenn sie eh schon vorhanden ist.

Kann mir bitte jemand helfen ? Idealerweise mit einem kleinen Codebeispiel ;)

Besten Dank !
lg gurkenprinz
 
dann musst du die oberen activities beenden

ist wie ein stack
 
public static final int FLAG_ACTIVITY_REORDER_TO_FRONT

Since: API Level 3
If set in an Intent passed to Context.startActivity(), this flag will cause the launched activity to be brought to the front of its task's history stack if it is already running.
For example, consider a task consisting of four activities: A, B, C, D. If D calls startActivity() with an Intent that resolves to the component of activity B, then B will be brought to the front of the history stack, with this resulting order: A, C, D, B. This flag will be ignored if FLAG_ACTIVITY_CLEAR_TOP is also specified.

Constant Value: 131072 (0x00020000)
Quelle: Intent | Android Developers

Einfach dem Intent per setFlag das Flag mitgeben.
 
  • Danke
Reaktionen: thomas.b.reuter, MichaelS, gurkenprinz und eine weitere Person

Ähnliche Themen

OnkelLon
Antworten
13
Aufrufe
1.923
OnkelLon
OnkelLon
L
Antworten
15
Aufrufe
890
jogimuc
J
R
Antworten
9
Aufrufe
713
koje71
koje71
Zurück
Oben Unten