(해결하기 위해 좌표)되어 사용할 수 없습니다이지만, "couldnt는이 주소를 얻을"작업과 출력 나던 :구글 지오 코더 서비스는 내가 좌표로 주소를 얻을 수있다
public String GetAddress(String lat, String lon)
{
Geocoder geocoder = new Geocoder(this, Locale.ENGLISH);
String ret = "";
try {
List<Address> addresses = geocoder.getFromLocation(Double.parseDouble(lat), Double.parseDouble(lon), 1);
if(addresses != null) {
Address returnedAddress = addresses.get(0);
StringBuilder strReturnedAddress = new StringBuilder("");
for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n");
}
ret = strReturnedAddress.toString();
ret=ret.substring(0, ret.length() - 1);
}
else{
ret = "Unknown Address";
}
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
ret = "Couldn't get Address";
}
return ret;
}
로그 캣 :
09-27 23:47:49.837: W/System.err(1862): java.io.IOException: Service not Available
09-27 23:47:49.847: W/System.err(1862): at android.location.Geocoder.getFromLocation(Geocoder.java:136)
09-27 23:47:49.847: W/System.err(1862): at com.example.free.Add.GetAddress(Add.java:634)
09-27 23:47:49.857: W/System.err(1862): at com.example.free.Add$LoadAddress.doInBackground(Add.java:608)
09-27 23:47:49.857: W/System.err(1862): at com.example.free.Add$LoadAddress.doInBackground(Add.java:1)
09-27 23:47:49.857: W/System.err(1862): at android.os.AsyncTask$2.call(AsyncTask.java:287)
09-27 23:47:49.857: W/System.err(1862): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-27 23:47:49.857: W/System.err(1862): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-27 23:47:49.857: W/System.err(1862): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
09-27 23:47:49.857: W/System.err(1862): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-27 23:47:49.857: W/System.err(1862): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-27 23:47:49.857: W/System.err(1862): at java.lang.Thread.run(Thread.java:856)
http://stackoverflow.com/questions/7109240/service-not-available-geocoder-android – nhgrif
실례합니다. 그것의 이상한 문제 .. – NirPes
[this] (http://stackoverflow.com/questions/4761052/why-is-android-geocoder-throwing-a-service-not-available-exception) 링크를 따라 갔습니까? – nhgrif