2017-06-14 48 views
1

當我點擊Geocode谷歌API與烏克蘭地址它將返回null在客戶端(在烏克蘭)的一些地址,但是當我在印度(在我身邊)測試它的工作完美。地理編碼谷歌API被卡住時轉換地址到拉長

代碼:

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; 
} 
+0

顯示我的代碼,沒有代碼我們什麼都不能做。 –

回答

0

顯示的代碼。 同時檢查地址是否不是空的從api