Reputation: 1
I created an android app and i want to start my app at the MainActivity every time my app is launched? That is if my app is at activity B and the user press the home key, then when the app is launched again, it starts at MainActivity instead of activity B? how i can do that ?
Upvotes: 0
Views: 94
Reputation: 95543
There is a flag for exactly this purpose. In the <activity>
declaration for your MainActivity
add:
android:clearTaskOnLaunch="true"
This will cause the app to start at MainActivity
whenever it is relaunched.
Upvotes: 1
Reputation: 488
There are few ways to do this -
<activity>
tag for your activity B, you can add 'android:noHistory=true'. Check this link to understand more - https://developer.android.com/guide/topics/manifest/activity-elementI hope this will solve your issue.
Upvotes: 0