Skip to content Skip to sidebar Skip to footer

Android Show Last Activity After Restarting An App

I have an Activity M which is the main Activity. I can access an Activity B from Activity M and another Activity C from Activity B. So M -> B -> C. When I am currently in the

Solution 1:

Try this...

@OverrideprotectedvoidonCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { 
        // Activity was brought to front and not created, // Thus finishing this will get us to the last viewed activity finish(); 
        return; 
    } 

    // Regular activity creation code... 
} 

This will always open the last activity from where the app was exited.....

Post a Comment for "Android Show Last Activity After Restarting An App"