Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 带异常的地理编码器_Android - Fatal编程技术网

Android 带异常的地理编码器

Android 带异常的地理编码器,android,Android,实际上,我正在查找地址的纬度和经度,但获取java.io.IOException的最长时间:等待服务器响应超时,我使用的模拟器基于API 19和Google API,任何人都可以提供帮助吗? 谢谢,这是我的源代码 Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault()); try { List<Address> addresses

实际上,我正在查找地址的纬度和经度,但获取java.io.IOException的最长时间:等待服务器响应超时,我使用的模拟器基于API 19和Google API,任何人都可以提供帮助吗? 谢谢,这是我的源代码

   Geocoder geocoder = new Geocoder(getApplicationContext(), 
   Locale.getDefault());
        try {
            List<Address> addresses = geocoder.getFromLocation(latitude, 
   longitude, 1);
            stringBuilder = new StringBuilder();
            if (addresses != null && addresses.size() > 0) {
                Address address = addresses.get(0);
                for (int i = 0; i < address.getMaxAddressLineIndex(); i++) {

   stringBuilder.append(address.getAddressLine(i)).append("\n");
                }
                stringBuilder.append(address.getLocality()).append("_");
                stringBuilder.append(address.getPostalCode()).append("_");
                stringBuilder.append(address.getCountryCode()).append("_");
                stringBuilder.append(address.getCountryName()).append("_");
                Log.i(tag, stringBuilder.toString());
            } else {
                ToastUtil.show(getApplicationContext(), "无效地址");
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
Geocoder-Geocoder=新的地理编码器(getApplicationContext(),
Locale.getDefault());
试一试{
列表地址=地理编码器.getFromLocation(纬度,
经度,1);
stringBuilder=新的stringBuilder();
if(addresses!=null&&addresses.size()>0){
地址=地址。获取(0);
对于(int i=0;i
你有机会在物理设备上试用吗,因为模拟器在物理方面效率不高。是的,我后来在真实的设备上试用过,也不例外,但我无法获得街道信息,只能获得地方和国家的信息,你知道获取某个地方详尽信息的方法吗?谢谢