Geocoding in android returns null value

六月ゝ 毕业季﹏ 提交于 2020-01-02 07:18:10

问题


i am doing geocoding in android get location from edittext and convert it into lat long and display on map but my address variable and list and has null values my address is like beauty Box A-9/1

my code is

     Geocoder gc =  new Geocoder(this);
      Address d ;
      double latitude = 0 ;
      double longitude = 0;

      try {
          List<Address>locname = gc.getFromLocationName(name, 5);

            d = locname.get(0);
            latitude = d.getLatitude();
            longitude= d.getLongitude();

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    GeoPoint dest = new GeoPoint((int)(latitude*1E6), (int)(longitude*1E6)); 

the locname is null i have tried many thing but no help

来源:https://stackoverflow.com/questions/12589329/geocoding-in-android-returns-null-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!