I am using Google map for android in my app. I want to reset my Google map with remove previously added Marker and zoom level.When I am clicking on button, previously added marker's were reset and added newly which I added.
But My problem is that I am not getting my map in default state(without zoom).I am getting updated map with zoom-in state which i previously zoomed.I want to get map with default state
I am refer Clear markers from Google Map in Android to reset my map.
My code is as below:
//set zoom in and zoom out on map navigation button click
private void moveToCurrentLocation(LatLng currentLocation) {
if (map != null) {
if (forZoomInZoomOut) {//if true map will zoomin to currentlocation
map.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation, 15));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomIn());
// Zoom out to zoom level 10, animating with a duration of 2 seconds.
map.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);
} else if (!forZoomInZoomOut){//if false map will reset
map.clear();//clear map to add new marker's
setMapMarker();//add markers here
}
}
}