I’m using a DrawerLayout for the navigation of my app:
Taking this menu for the example:
I’d like the Home button to launch the HomeActivity and so on. But clearing the activity stack, that is: If I press People, then Photos, then Locations and then the back button, the app should close. I’m trying intent flags when launching the activities but I always get the same behaviour: People->Photos->Location->Back goes to Photos instead closing the app
How can I achieve that?
Advertisement
Answer
As per you said that “If I press People, then Photos, then Locations and then the back button, the app should close”.
For achieve that you should user Fragment for Home,People,Location and Photos etc. and when you press back button of Device you can clear Fragment back stack and finish activity.