【发布时间】:2013-07-30 19:41:54
【问题描述】:
好的..我已经看到了很多关于这个的问题:例如
Geocoder error java.io.IOException: Unable to parse response from server 等等..没有给我答复!
谁能帮帮我??我的应用程序可以正常运行几分钟,但其余时间会出现 IOException:
Geocoder gcd = new Geocoder(getApplicationContext(), Locale.getDefault());
List<Address> addresses = null;
try {
addresses = gcd.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
if (addresses!= null && addresses.size() > 0 )
txtLat.setText(addresses.get(0).toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我的日志是:
07-30 16:24:20.351: W/System.err(5170): java.io.IOException: Unable to parse response from server
07-30 16:24:20.351: W/System.err(5170): at android.location.Geocoder.getFromLocation(Geocoder.java:136)
07-30 16:24:20.351: W/System.err(5170): at com.example.test.MainActivity.onLocationChanged(MainActivity.java:46)
07-30 16:24:20.351: W/System.err(5170): at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:227)
07-30 16:24:20.351: W/System.err(5170): at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:160)
【问题讨论】:
-
addresses.get(0).toString() 打印出来看看值是多少。
标签: android