Issue
I have two activities and each has a Mapview. The problem is that when a Mapview changes its center or zoom the other one changes too. I’ve realized that each Mapview has a different id (in xml) and a different name variable. But the problem persist.
The code of each activity is too long to post here, because it implements a lot of functions. But I post the most significant part:
Activity A)
mapview_publish = (MapView) findViewById(R.id.mapview_publish);
mapview_publish.setBuiltInZoomControls(true);
mapController = mapview_publish.getController();
mapController.setZoom(16); /
XML A)
<com.google.android.maps.MapView
android:id="@+id/mapview_publish"
android:layout_width="fill_parent"
android:layout_height="87dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_marginTop="12dp"
android:apiKey="myapikey"
android:clickable="false" />
Activity B)
mapView = (MapView) findViewById(R.id.mapview);
mapview.setBuiltInZoomControls(true);
mapController = mapView.getController();
mapController.setZoom(20);
XML B)
<com.google.android.maps.MapView
android:id="@+id/mapview"
style="@style/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:apiKey="myapikey"
android:background="@color/black"
android:clickable="true" />
Solution
If you're using multiple MapViews per process, it might conflict.
Only one MapActivity is supported per process. Multiple MapActivities running simultaneously are likely to interfere in unexpected and undesired ways.
And also see my reply on How to use multiple MapActivities/MapViews per Android application/process
But as SpK commented, please provide the code of your activities.
Answered By - Mathias Conradt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.