As the documentation says if that activity has set launchMode="singleTop" in the manifest, the intent will come in through the onNewIntent callback.
I have been unable to get this behavior when the activity was started by a TabHost. Instead of calling onNewIntent, the activity's onCreate method is called, resulting in a new instance of the activity on top of the activity stack.
This is my code for starting the intent:
// create the TabHost that will contain the Tabs
tabHost = (TabHost)findViewById(android.R.id.tabhost);
TabSpec tab1 = tabHost.newTabSpec("First Tab");
TabSpec tab2 = tabHost.newTabSpec("Second Tab");
TabSpec tab3 = tabHost.newTabSpec("Third tab");
// Set the Tab name and Activity
// that will be opened when particular Tab will be selected
tab1.setIndicator("Tab1");
Intent intent = new Intent(this, WhenLogin.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|
Intent.FLAG_ACTIVITY_SINGLE_TOP);
tab1.setContent(intent);
Has anyone else had this problem? If so, have they found a solution?
TabHost
"? – CommonsWareTabHost
". – CommonsWare