Reputation: 3231
I have a Dashboard/Home Activity
where I show multiple icons to different Activity
s.
My requirement is that, whenever I minimize my app I want to resume to Home Activity
and not to any of the child activities.
I tried
noHistory="true"
in manifest for those child activities.
But one Activity
e.g. A has its own child activities.so when I go to A and then its child Activity
A_1 and press back I come to Home
screen.
I have tried adding flag in intent
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
But it did not work.
Upvotes: 0
Views: 60
Reputation: 1741
Also, I guess a less elegant approach would be to call finish() in the onPause() or onStop() methods of those child activities. This will make sure they are destroyed and will not be able to be returned to.
Upvotes: 0
Reputation: 13384
I think you need to use FLAG_ACTIVITY_CLEAR_TOP when you minimize the App.
Upvotes: 0
Reputation: 29199
You can do this by setting intent flag on minimize event.
Intent intent= new Intent(A_1.this, HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
A-1, is the activity from where this event has been fired, and HomeActivity is the name of home/dashboard activity class.
Upvotes: 3