Rohit Walavalkar
Rohit Walavalkar

Reputation: 818

FLAG_ACTIVITY_SINGLE_TOP not working

I have an activity which I can start from Launcher . I have made some changes to Navigation bar so that i can start the same activity from navigation bar also.

But the expected behavior is that the activity should not start again if it is already on top of stack so I used FLAG_ACTIVITY_SINGLE_TOP as flag. But it does not seam to work. I know that we can also achieve it specifying the launchmode as singleTask. But i dont want to use that as I may be starting some 3rd party apps from navigation bar

Upvotes: 5

Views: 1911

Answers (1)

Justin Pollard
Justin Pollard

Reputation: 6679

Have you tried

launchMode:singleTop

in the definition of your activity in the manifest? e.g.

<activity
        android:name=".MyActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:launchMode="singleTop">
</activity>

Upvotes: 1

Related Questions