Darko Petkovski
Darko Petkovski

Reputation: 3912

Android onResume open specific activity

I need to do the following in my app, but I dont know is it possible? If so can anyone tell me how can I do that?

I start the app - > First Actvity - >second activity(child)->third activity(second activity child) - and here ex. I press home button and third goes to pause. And now when I return to the app I need to return to the first activity not the same one. Can anyone tell me how can I do this?

Upvotes: 1

Views: 331

Answers (2)

Shmuel
Shmuel

Reputation: 3916

Set android:clearTaskOnlaunch="true" on the activity launched from the home screen.

From developer.android.com:

"When the value is "true", every time users start the task again, they are brought to its root activity regardless of what they were last doing in the task and regardless of whether they used the Back or Home button to leave it. When the value is "false", the task may be cleared of activities in some situations (see the alwaysRetainTaskState attribute), but not always."

Set this on the main activity ie. the one launched from the home screen.

Upvotes: 2

SeahawksRdaBest
SeahawksRdaBest

Reputation: 886

Please look at the concept of Fragments. I have explained this idea in the following link.

Upvotes: 1

Related Questions