views:

77

answers:

1

I have an app that I have running a media player and I want to resume the activity from my apps home activity.

I can successfully do this by adding the following flags to the startActivity Call:

myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

I am worried that this is not an ideal way to do things since it took me a long time to find it. It made me think that no one uses it very much.

Are there any pitfalls to using this method?

Thanks for your help

A: 

Just to make sure I understand your question correctly: Say your activity stack is something like A -> B -> C, and now from C you want to clear the stack and get back to A.

If this is what you want, then those intent flags are correct and should work as expected, as per the docs (http://developer.android.com/reference/android/content/Intent.html#FL)

Ketan