1

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?

Darko Petkovski
  • 3,892
  • 13
  • 53
  • 117

2 Answers2

2

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.

Shmuel
  • 3,916
  • 2
  • 27
  • 45
  • not working - added `android:clearTaskOnLaunch="true"` for all activities except the splash, but when I press home and return to the app - i get back to the same activity – Darko Petkovski Mar 10 '14 at 19:21
  • only add it to the main activity. (the one launched from the home screen that you want to go back to.) – Shmuel Mar 10 '14 at 19:35
  • also, read this - https://groups.google.com/forum/#!topic/android-developers/2gJLyvThlg8 – Shmuel Mar 10 '14 at 19:40
1

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

Community
  • 1
  • 1
SeahawksRdaBest
  • 868
  • 5
  • 17