3

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
        }
    }

}
Community
  • 1
  • 1
pRaNaY
  • 24,642
  • 24
  • 96
  • 146
  • have you got a look at: https://developers.google.com/maps/documentation/android-api/map#configuring_initial_state – denis_lor Nov 03 '15 at 13:05

1 Answers1

0

There's no such thing as a map with no zoom level. You have to set the zoom to what you want when you clear everything.

nasch
  • 5,330
  • 6
  • 31
  • 52
  • I got my new marker after resetting my map. but i got map with previously zoom state.which I want in normal state of map. – pRaNaY Nov 04 '15 at 04:09
  • i want my map exactly return state when my map is loaded first time. – pRaNaY Nov 09 '15 at 03:55