I try to find lat and long from the address specified by the user, for this I use the following code,
GeoPoint pointForEnterAddr;
try {
List<Address> address = coder.getFromLocationName(enterAddr, 1);
if (address == null)
pointForEnterAddr = null;
else {
Address location = address.get(0);
System.out.println("Lat in button click :"
+ location.getLatitude());
System.out.println("Long in button click :"
+ location.getLongitude());
pointForEnterAddr = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));
}
catch (Exception ex) {
System.out.println("Error here :" + ex);
}
But every time he comes to catch a part and show an exception, java.io.IOException: service is unavailable
How can I solve this problem and get the right result? Plz tell me.
thank
source
share