【发布时间】:2016-12-22 03:44:37
【问题描述】:
当我注意到某些地址会返回错误而其他地址运行良好时,我正在使用 google places 自动完成 api。然而,即使发生错误,错误回调也会显示错误消息具有error code : 0 和Success 状态。我正在使用谷歌地方自动完成Fragment。
错误打印出来:I/DESTINATION: An error occurred: SUCCESS
private void setDestinationAutocompleteCallbacks() {
DestinationautocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
LatLng destinationLatLng = place.getLatLng();
OriginAndDestinationLocations[1] = destinationLatLng;
mMap.addMarker(new MarkerOptions()
.position(destinationLatLng)
.title(getString(R.string.destinationLocation))
.snippet(place.getAddress().toString()))
.showInfoWindow();
if (OriginAndDestinationLocations[0] != null) {
adjustZoom();
} else {
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(destinationLatLng, Zoom), 2000, null);
}
}
@Override
public void onError(Status status) {
Log.i(DESTINATIONTAG, "An error occurred: " + status.getStatusMessage());
}
});
}
【问题讨论】:
标签: android google-maps google-api google-places-api google-places