Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid HttpURLConnection FATAL Error
    primarykey
    data
    text
    <p>I am coding a download manager for android , when i try to open httpurlconnection it gives error</p> <pre><code>07-17 20:30:13.928: E/AndroidRuntime(25485): FATAL EXCEPTION: main 07-17 20:30:13.928: E/AndroidRuntime(25485): java.lang.IllegalStateException: Could not execute method of the activity 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.view.View$1.onClick(View.java:3699) 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.view.View.performClick(View.java:4223) 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.view.View$PerformClick.run(View.java:17275) 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.os.Handler.handleCallback(Handler.java:615) 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.os.Handler.dispatchMessage(Handler.java:92) 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.os.Looper.loop(Looper.java:137) 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.app.ActivityThread.main(ActivityThread.java:4921) 07-17 20:30:13.928: E/AndroidRuntime(25485): at java.lang.reflect.Method.invokeNative(Native Method) 07-17 20:30:13.928: E/AndroidRuntime(25485): at java.lang.reflect.Method.invoke(Method.java:511) 07-17 20:30:13.928: E/AndroidRuntime(25485): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038) 07-17 20:30:13.928: E/AndroidRuntime(25485): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) 07-17 20:30:13.928: E/AndroidRuntime(25485): at dalvik.system.NativeStart.main(Native Method) 07-17 20:30:13.928: E/AndroidRuntime(25485): Caused by: java.lang.reflect.InvocationTargetException 07-17 20:30:13.928: E/AndroidRuntime(25485): at java.lang.reflect.Method.invokeNative(Native Method) 07-17 20:30:13.928: E/AndroidRuntime(25485): at java.lang.reflect.Method.invoke(Method.java:511) 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.view.View$1.onClick(View.java:3694) 07-17 20:30:13.928: E/AndroidRuntime(25485): ... 11 more 07-17 20:30:13.928: E/AndroidRuntime(25485): Caused by: java.lang.NullPointerException: println needs a message 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.util.Log.println_native(Native Method) 07-17 20:30:13.928: E/AndroidRuntime(25485): at android.util.Log.d(Log.java:155) 07-17 20:30:13.928: E/AndroidRuntime(25485): at com.example.flinkdownloadmanager.DownloadService.DownloadFile(DownloadService.java:87) 07-17 20:30:13.928: E/AndroidRuntime(25485): at com.example.flinkdownloadmanager.MainActivity.DownloadItem(MainActivity.java:115) 07-17 20:30:13.928: E/AndroidRuntime(25485): ... 14 more </code></pre> <p>and this is my code for the downloader </p> <pre><code>public void DownloadFile(String uri) { //Toast.makeText(this, uri, Toast.LENGTH_SHORT).show(); int count; try { URL url = new URL(uri); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setInstanceFollowRedirects(false); connection.connect(); } catch (Exception e) { Log.e("Error: ", e.getMessage()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload