简体   繁体   中英

Location of the center of the map-fragment - Android Google Maps

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.

在此处输入图片说明

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);

}

我想这应该工作:

mMap.getCameraPosition().target

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM