java.io.IOException:_Service_not_Available
try {
List<Address> addresses = geoCoder
.getFromLocation(p.getLatitudeE6() / 1E6, p
.getLongitudeE6() / 1E6, 1);
String add = "";
if (addresses.size() > 0) {
for (int i = 0; i < addresses.get(0)
.getMaxAddressLineIndex(); i++)
add += addresses.get(0).getAddressLine(i) + "\n";
}
Toast.makeText(getBaseContext(), add, Toast.LENGTH_SHORT)
.show();
} catch (IOException e) {
e.printStackTrace();
}
Java code
05-27 06:26:28.935: WARN/System.err(1542): java.io.IOException: Service not Available
05-27 06:26:28.935: WARN/System.err(1542): at android.location.Geocoder.getFromLocation(Geocoder.java:117)
05-27 06:26:28.935: WARN/System.err(1542): at com.fh.map.MyMap$MapOverlay.onTouchEvent(MyMap.java:147)
05-27 06:26:28.945: WARN/System.err(1542): at com.google.android.maps.OverlayBundle.onTouchEvent(OverlayBundle.java:63)
05-27 06:26:28.945: WARN/System.err(1542): at com.google.android.maps.MapView.onTouchEvent(MapView.java:643)
05-27 06:26:28.955: WARN/System.err(1542): at android.view.View.dispatchTouchEvent(View.java:3766)
05-27 06:26:28.955: WARN/System.err(1542): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:897)
05-27 06:26:28.955: WARN/System.err(1542): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
05-27 06:26:28.965: WARN/System.err(1542): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
05-27 06:26:28.965: WARN/System.err(1542): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
05-27 06:26:28.965: WARN/System.err(1542): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
05-27 06:26:28.965: WARN/System.err(1542): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671)
05-27 06:26:28.965: WARN/System.err(1542): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
05-27 06:26:28.984: WARN/System.err(1542): at android.app.Activity.dispatchTouchEvent(Activity.java:2086)
05-27 06:26:28.984: WARN/System.err(1542): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655)
05-27 06:26:28.984: WARN/System.err(1542): at android.view.ViewRoot.handleMessage(ViewRoot.java:1785)
05-27 06:26:28.984: WARN/System.err(1542): at android.os.Handler.dispatchMessage(Handler.java:99)
05-27 06:26:28.984: WARN/System.err(1542): at android.os.Looper.loop(Looper.java:123)
05-27 06:26:28.984: WARN/System.err(1542): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-27 06:26:28.984: WARN/System.err(1542): at java.lang.reflect.Method.invokeNative(Native Method)
05-27 06:26:28.984: WARN/System.err(1542): at java.lang.reflect.Method.invoke(Method.java:521)
05-27 06:26:28.984: WARN/System.err(1542): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-27 06:26:28.984: WARN/System.err(1542): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-27 06:26:28.984: WARN/System.err(1542): at dalvik.system.NativeStart.main(Native Method
换真机试一下