After some investigations I've noticed that it is impossible to do that in such way. But good news is that i've got some workaround:
You have to create two Activities
, each with corresponding launchModes.
One Activity
is real Activity
with your code inside, and another one will just call main Activity
in onCreate()
method, but since it will have needed launchMode, main Activity
will be launched with that mode. Not very nice, but completely working solution.
After that, instead of trying open your Activity
with intent flags, put in intent class
of the Activity
according to launchMode you need.