Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top