Hello All: I am creating an application in which I am using menus on every screen for the user to navigate. In my application, I have Screen1--> comes as home screen when the user logs in Screen2--> user goes to this screen to perform some operations. Now on Screen2 I want to have menu option to let the user go to home screen. But to start the activity we do
startActivity(new Intent(Home.this, Screen2.class));
But, I want to use the existing home screen which was created when the used logged in and then using onresume method I can update the home screen.
Can anybody please tell me how to use the existing intents or activity to provide menu options? Thanks Ashwani
Take a look at android:launchMode attribute of element. Is "singleTop" launch mode is what you mean by "use existing home screen"? If you use "singleTop" the activity is not recreated, but receives onNewIntent() signal.
Ashwani,
I believe this can be done with a
setFlags()
call on yourIntent
using theFLAG_ACTIVITY_REORDER_TO_FRONT
flag. If screen 1 still exists it will bring it to the foreground. The documentation doesn't seem to specify, but I assume it launches a new Activity of Screen 1 was killed.