I\'ve got an application with several activities, for example:
Activity 1 --> Activity 2 --> Activity 3 --> Activity 4
And I would like to close all the acti
Open up AndroidManifest.xml and find the activity that you would like to return to and add the following attribute
android:launchMode="singleTask"
For example, HomeActivity class might have this in android manifest
At any point, you can close all activities on top of this one by using startActivity the standard way, for example
startActivity(new Intent(this, HomeActivity.class));
If you normally pass extras to the intent, there's no need to do this as it will come back in whatever state it was before, and it's even accompanied by an animation like hitting the back button.