joe fayyaz
joe fayyaz

Reputation: 61

How to fix google map to a location

I want to set a google map location with lat/long so that it can't be changed by user. How to do it?

 double latitude = 35.6961;
 double longitude = 51.4231;
 MarkerOptions marker = new MarkerOptions().position(
        new LatLng(latitude, longitude)).title("Hello Maps");

 marker.icon(BitmapDescriptorFactory
       .defaultMarker(BitmapDescriptorFactory.HUE_ROSE));
 googleMap.addMarker(marker);
 CameraPosition cameraPosition = new CameraPosition.Builder()
          .target(new LatLng(35.6961, 51.4231)).zoom(12).build();
 googleMap.animateCamera(CameraUpdateFactory
          .newCameraPosition(cameraPosition));

Upvotes: 0

Views: 1565

Answers (1)

Kristo
Kristo

Reputation: 1367

Try to add this line below your code.

googleMap.getUiSettings().setScrollGesturesEnabled(false);

This will forbid the user to scroll the map.

Upvotes: 3

Related Questions