Exiting Android Application

Suppose in our application, we have a number of activities(say ten) and we need to exit directly from this activity. What we can do is, create an intent and go to the root activity and set flag in the intent as


also, add some extra like boolean to the intent

intent.putExtra("EXIT", true);

Then in root activity, check the value of the boolean and according to that call finish(), in the onCreate() of the root activity

if (getIntent().getBooleanExtra("EXIT", false)) {


Popular posts from this blog

Open Gallery and get the selected image in appplication

Dismiss or Cancel dialog by swipe gesture

AlarmManager and Notification in Android