2
votes

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, just calling onResume() of the one that lies in TabActivity

Tried set different launchMode ("singleTop", "singleTask", "singleInstance") and set flags for intent:

intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER);

How to do it not creating a new instance of activity?

1
Pull the code you require to call into a static method. Then call it using OneActivity.yourMethod();dymmeh

1 Answers

5
votes

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);