我正在尝试从自动完成编辑文本中检索到的地点ID中获取地点的纬度和经度,但未调用回调:
Places.GeoDataApi.getPlaceById(mGoogleApiClient, data.getPlaceId())
.setResultCallback(new ResultCallback<PlaceBuffer>() {
@Override
public void onResult(PlaceBuffer places) {
Toast.makeText(Location_getter.this, "hello", Toast.LENGTH_SHORT).show();
if (places.getStatus().isSuccess() && places.getCount() > 0) {
Toast.makeText(Location_getter.this, "hello", Toast.LENGTH_SHORT).show();
// Get the Place object from the buffer.
LatLng latLngDrop = places.get(0).getLatLng();
Log.i("hell", "Place found: " + places.get(0).getName());
Log.v("latitude:", "" + latLngDrop.latitude);
Log.v("longitude:", "" + latLngDrop.longitude);
} else {
Log.e("hel", "Place not found");
}
places.release();
}
});