Issue
I have 2 activities that contains MapView
.
In activity A mapview have different size then in activity B.
The call hirarchy is Activity
A -> Activity
B.
When I'm returning from Activity
B to A the half of the map is black (only Google sign remains in left corner).
Moving map has no effect (bottom of the map is still black) only zoom in/out makes map looks properly.
In android manifest I use different ID's,
I've tried invalidate()
mapview in onResume()
method,
I've tried to call findViewById(android.R.id.content).requestLayout()
on whole layout also in onResume()
with no effect.
The only solution was to finish()
activity onPause()
and create it again on keyback in activity B.
Is there any other way to fix this?
Solution
You will see in your LogCat that the Activities are reusing the undelaying Map:
MapActivity: Recycling map object
To restore your old settings in the map use the onResume method on both activities:
@Override
protected void onResume() {
super.onResume();
MapController mapController = mMapView.getController();
mapController.setCenter(mCenterPoint);
mapController.setZoom(mZoomLevel);
mapController.animateTo(mCenterPoint);
}
As onCreate will only be called once and the back button or new Intent will (hopefully) reuse the actual Intent on the stack.
Answered By - rgrocha
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.