Monday, 27 June 2016

Google Maps - Get the center point

Now a day we have apps like Uber or Careem which has a fix point to the center of the map. To get the latitude and longitude of the center of the map, do the follow:

// Get the center of the map and update it as the camera changes
mGoogleMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
    public void onCameraChange(CameraPosition cameraPosition) {
        LatLng mapCenterPoint =;
        Log.v(TAG, "The center of the map is " + mapCenterPoint);

Where mGoogleMap is the type of GoogleMap.

No comments:

Post a Comment