Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 812
Rohit Walavalkar Avatar asked Nov 13 '22 05:11

Rohit Walavalkar


1 Answers

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>
like image 72
Justin Pollard Avatar answered Nov 15 '22 00:11

Justin Pollard