应用程序的主要活动是TabActivity包含一些OneActivity
The main activity of the app is TabActivity that contains some OneActivity
这是需要从应用程序的其他部分调用OneActivity没有创造它的另一个实例, 只是调用一个位于TabActivity的onResume()
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
尝试设置不同的launchMode(singleTop,singleTask,singleInstance),并设置标志的意图:
Tried set different launchMode ("singleTop", "singleTask", "singleInstance") and set flags for intent:
intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER);
如何做到这一点没有创造活动的一个新实例?
How to do it not creating a new instance of activity?
尝试 CLEAR_TOP
标志。我删除所有上述活动您在活动栈的活动,所以它应该可以解决你的目的。
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);