Android: new Intent() starts new instance with android:launchMode="singleTop"

Posted by Stefan Klumpp on Stack Overflow See other posts from Stack Overflow or by Stefan Klumpp
Published on 2010-03-11T11:28:22Z Indexed on 2010/03/11 17:59 UTC
Read the original article Hit count: 387

Filed under:
|
|

I have Activity A with android:launchMode="singleTop" in the manifest.

If I go to Activity B, C and D there I have menu shortcuts to return to my applications root activity (A).

The code looks like this:

Intent myIntent = new Intent(getBaseContext(), MainActivity.class);
startActivity(myIntent);

However, instead of returning to the already existing instance A of my MainActivity.class it creates a new instance -> it goes to onCreate() instead of onNewIntent().

This is not the expected behavior, right?

© Stack Overflow or respective owner

Related posts about android

Related posts about activity