我正在製作一個應用程序,該應用程序正在使用谷歌地圖api v2。我的問題是,當我註冊相機更改偵聽器時,它會在每次移動相機時移動,而不是在移動停止時執行。我想實現後者。我怎樣才能修改我的代碼只在移動停止時註冊?Android谷歌地圖v2在用戶停止移動攝像頭時執行asynctask
這裏是我的代碼:
mMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition position) {
LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds;
ne = bounds.northeast;
sw = bounds.southwest;
ne1 = ne.latitude;
ne2 = ne.longitude;
sw1 = sw.latitude;
sw2 = sw.longitude;
new DownloadJSON().execute();
}
});
http://stackoverflow.com/questions/13702117/how-can-i-handle-map-move-end-using-google-maps-for-android-v2 – Carnal
的代碼不完整。難以理解 – Traabefi