Reputation: 21616
I have an intent which i need to set it, two flags:
FLAG_ACTIVITY_SINGLE_TOP -> coz i wanna keep the instance of the current activity in case it' already focused.
FLAG_ACTIVITY_NEW_TASK -> coz i launch the intent outside of it's activity(contexnt.startactivity(..))
problem is that i cant combine both of them.. any other solution?
this is my exception:
06-30 09:12:48.577: ERROR/AndroidRuntime(2460): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag.
Is this really what you want?
thanks,
ray.
Upvotes: 1
Views: 5343
Reputation: 313
The task of combining bitmasks is explained here http://softwareblog.alcedo.com/post/2011/05/31/Using-e2809core2809d-to-combine-A-and-B-Explaining-that-bitmask-thing.aspx in a pretty good way.
Skipping explanations, straight to the case.
Use the OR-operator to combine flags:
setFlags(FLAG_ACTIVITY_SINGLE_TOP|FLAG_ACTIVITY_NEW_TASK);
Upvotes: 8
Reputation: 21616
solution was to use addFlags instead of setFlags, but it still didnt influence.. for example if i currently use browser, and i run another browser intent with those flags, the current page IS being channged
Upvotes: 4