Question

I need to get the location of the center of my map-fragment. Of course it is not the center of the screen. I want to do something every time this location changes.

Every time the user moves/scrolls the map, I need the location of the center of my fragment and do something with them.

So, any Idea of how can I do that?

Thank you in advance for your help.

enter image description here

EDIT:

So I implemented OnCameraChangeListener and added onCameraChange but it never executes:

@Override
public void onCameraChange(CameraPosition arg0) {
    Log.v("tag", "onCameraChange");

    mLatitude = arg0.target.latitude;
    mLongitude = arg0.target.longitude;
    Log.v("tag", "onCameraChange  "+mLatitude+" "+mLongitude);

}
Was it helpful?

Solution

I guess this should work:

mMap.getCameraPosition().target
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top