简体   繁体   中英

Android resume activity with Intent

I've GOOGLE MAPS with some overlays on it. The overlays are taken from a databse, so it takes some time to load the overlays.

Then I click to one overlay to bring another activity with info about that overlay. This info is a new activity created via Intent.

Then I want to go back to the map. Ok, I click the button and it calls an new Intent to go back to the map.

The map appears but the overlays don't.

I figured out that one solution could be RESUMING the map instead of STARTING a new map with the intent.

I tried to add a flag to resume the activity but it doesn't work.

In the button I do:

Intent myIntent = new Intent(mContext,MapClass.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
mContext.startActivity(myIntent);   

Please, any clues?

Then I want to go back to the map. Ok, I click the button and it calls an new Intent to go back to the map.

Why ? First, why do you need a button to go back ? Just let the user go back using the device's Back button. Secondly, if you really need to use a back button (which I don't know why would you), why create a new intent to go back ? Just call finish() on the Activity with the button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM