Take Latitude and Longitude from an address

Asked

Viewed 328 times

0

Until last week this code that I had made was going well, until today I went to test again and I see this:

05-28 08:22:12.851: E/AndroidRuntime(19605): FATAL EXCEPTION: main
05-28 08:22:12.851: E/AndroidRuntime(19605): java.lang.IllegalStateException: Could not execute method of the activity
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.view.View$1.onClick(View.java:3660)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.view.View.performClick(View.java:4162)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.view.View$PerformClick.run(View.java:17088)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.os.Handler.handleCallback(Handler.java:615)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.os.Handler.dispatchMessage(Handler.java:92)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.os.Looper.loop(Looper.java:137)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.app.ActivityThread.main(ActivityThread.java:4867)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at java.lang.reflect.Method.invokeNative(Native Method)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at java.lang.reflect.Method.invoke(Method.java:511)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at dalvik.system.NativeStart.main(Native Method)
05-28 08:22:12.851: E/AndroidRuntime(19605): Caused by: java.lang.reflect.InvocationTargetException
05-28 08:22:12.851: E/AndroidRuntime(19605):    at java.lang.reflect.Method.invokeNative(Native Method)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at java.lang.reflect.Method.invoke(Method.java:511)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.view.View$1.onClick(View.java:3655)
05-28 08:22:12.851: E/AndroidRuntime(19605):    ... 11 more
05-28 08:22:12.851: E/AndroidRuntime(19605): Caused by: java.io.IOException: Unable to parse response from server
05-28 08:22:12.851: E/AndroidRuntime(19605):    at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at in.wptrafficanalyzer.locationdistancetimemapv2.MainActivity.getLatLng(MainActivity.java:131)
05-28 08:22:12.851: E/AndroidRuntime(19605):    at in.wptrafficanalyzer.locationdistancetimemapv2.MainActivity.goTo(MainActivity.java:149)
05-28 08:22:12.851: E/AndroidRuntime(19605):    ... 14 more

The code stops executing at the moment it makes this request:

List<Address> addresses = geoCoder.getFromLocationName(endereco, 1);

1 answer

1

Try adding this permission to the manifest file:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Translated of that response from the SOEN. The case appears to be similar to yours, and apparently this was the accepted solution.

  • you already have that permission

  • @Enzotiezzi, Ioexception is an Exception, when you cannot save to disk, or there is some error while saving to disk. In your case only happens in a specific case?

  • did not happen, previously everything ran perfect, but today I went to test put an address to get the lat and long, and fell into this.

  • any address I try, it gives this Exception

  • so much that now, suddenly, it’s back up and I don’t know why

  • @Enzotiezzi. There is the possibility that it is a problem in your network. Try to test in another network. Or maybe even on Google service (unlikely, since it is stable).

  • then, I raised these points, and will make an error treatment for the user end up trying again.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.