Skip to content Skip to sidebar Skip to footer

Android Singleton Activity

The main activity of the app is TabActivity that contains some OneActivity It is necessary to call from another part of app the OneActivity not creating the another instance of it,

Solution 1:

Try the CLEAR_TOP flag. I removes all the activities above your activity in the activity stack, so it should solve your purpose.

Intent i = new Intent(context, YourSingleInstanceActivityName.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);

Post a Comment for "Android Singleton Activity"