Reputation: 1119
private void setCurrentLocationMarker(LatLng currLatLng) {
if (currLatLng == null) {
Toast.makeText(getActivity(), "Check Internet Connection", Toast.LENGTH_SHORT).show();
return;
}
mMap.moveCamera(CameraUpdateFactory.newLatLng(currLatLng));
mMap.animateCamera(CameraUpdateFactory.zoomBy(R.integer.camera_zoom_value));
setMarkerAtCentre(mMap.getCameraPosition().target);
}
private void setMarkerAtCentre(LatLng cameraCentre){
if(cameraCentre == null) return;
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(cameraCentre);
markerOptions.icon(BitmapDescriptorFactory.defaultMarker());
markerOptions.title("Your Position");
sourceMarker = mMap.addMarker(markerOptions);
}
Above two are the functions for setting the marker to desired latitude and longitude and placing the camera focusing the location. Everything is working fine. But the problem which I face here is with the zoom
mMap.animateCamera(CameraUpdateFactory.zoomBy(R.integer.camera_zoom_value));
I may place any value for the zoom.
<integer name="camera_zoom_value">2</integer>
But the zoom which I get always is the maximum one i.e. the largest possible zoom, which is kinda issue here.
Can anyone help me out? Thanks in advance.
Upvotes: 1
Views: 199
Reputation: 3527
your are passing the resource integer directly without using getResources().getInteger() so the value passed is some long integer > 20 leading to maximum zoom. Fix that and it will work.
Upvotes: 1