Actually, to go to the action of your choice, you must use the up navigation, which is used on the action bar:
public static void goUpToTopActivity(final Activity currentActivity) { final Intent intent = NavUtils.getParentActivityIntent(currentActivity); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); NavUtils.navigateUpTo(currentActivity, intent); }
to use it, you must set the action in the manifest that this function should use (or you can of course set it yourself by changing the code):
if you use actionBarSherlock, for every action you want to open, use:
<meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.your_app.activities.MainActivity" />
if you use the android framework (if your version of minSdk is API 16 and above), use " parentActivityName ".
android developer
source share