Reputation: 333
There are 6 activities in my application .
I start new activity when click menu item even if same activity started previously . There is no need to start new activity.
How can i get that running previously activity?
Upvotes: 1
Views: 1396
Reputation: 232
in your AndroidManifest.xml
declare your activity as SingleInstace
(Application->Activity->Launch mode->SingleInstance).
If your activity is running then it doesn't create a new one.
Upvotes: 1
Reputation: 1006674
How can i get that running previously activity ?? and run it ??
Add FLAG_REORDER_TO_FRONT
on the Intent
you use with startActivity()
.
Upvotes: 1
Reputation: 5889
Look at android:launchMode
here: http://developer.android.com/guide/topics/manifest/activity-element.html#lmode. "singleTop"
is probably what you want.
Note that the default behavior is the way it is to make the back button work automatically.
Upvotes: 2