2

I got an App where on main screen show google mapView. But I need also in details view show the map.

I know that it is impossible to run two maps simultaneously. Everything is working when I want to show something on the main map and later in detailed view, but when I come back to main one, it stops.

How to stop main map and come back later to it?

3 Answers 3

2

Having two maps in one app produces many weird application behavior. For example, Ive had overlays from one map show up in the second map.
That said, it is possible to have two maps in one application without the above happening. What you need to do is to specify a new process for the second mapview:

<activity
        android:label="@string/app_name"
        android:name=".SecondMapActivityName"
        android:process=":SecondMapProcess"
         >
</activity>

The above code lies in the manifest and is for the activity containing the second MapView. This way a new process starts for this activity within the same app and both your maps behave as they should.

Sign up to request clarification or add additional context in comments.

2 Comments

i tried your idea but its showing black screen for fraction of a second in activity switching.
@Akki, generally one app is one process in Android. But now since your other map is in another process, performance wise its like another app starting up, hence the short interval of black screen. Glad to hear that goodm.
1

What I do is create a new mapview in code each time I want to use it (yes overhead but it works ;)).

mMapView = new MapView(this, MAPS_KEY);
setContentView(mMapView);
mMapView.invalidate();

Comments

0

If you don't need to interact with your other map, you can use it in lite mode: https://developers.google.com/maps/documentation/android-api/lite

It creates a bitmap image that looks like a map.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.