Get Latitude and Longitude from an address

0

Until last week this code that I had made was working fine, until today I went to test it again and this appears to me:

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 to run the moment it makes this request:

List<Address> addresses = geoCoder.getFromLocationName(endereco, 1);
    
asked by anonymous 28.05.2014 / 13:25

1 answer

1

Try adding this permission to the manifest file:

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

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

    
28.05.2014 / 13:36