[英]geocode google api stuck when convert address to lat long
当我点击带有乌克兰地址的Geocode Google API时,它会在客户端(乌克兰)的某些地址返回null
,但是当我在印度(在我身边)测试它时,它的工作非常完美。
码:
private LatLng getLocationFromAddress(final String place){
LatLng loc = null;
Geocoder gCoder = new Geocoder(getActivity() );
try {
final List<Address> list = gCoder.getFromLocationName(place, 1);
if (list != null && list.size() > 0) {
loc = new LatLng(list.get(0).getLatitude(), list.get(0).getLongitude());
}
}
catch (IOException e) {
e.printStackTrace();
}
return loc;
}
显示代码。 同时检查api中的地址是否为空
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.