java - Android HttpURLConnection FATAL Error -
i coding download manager android , when try open httpurlconnection gives error
07-17 20:30:13.928: e/androidruntime(25485): fatal exception: main 07-17 20:30:13.928: e/androidruntime(25485): java.lang.illegalstateexception: not execute method of activity 07-17 20:30:13.928: e/androidruntime(25485): @ android.view.view$1.onclick(view.java:3699) 07-17 20:30:13.928: e/androidruntime(25485): @ android.view.view.performclick(view.java:4223) 07-17 20:30:13.928: e/androidruntime(25485): @ android.view.view$performclick.run(view.java:17275) 07-17 20:30:13.928: e/androidruntime(25485): @ android.os.handler.handlecallback(handler.java:615) 07-17 20:30:13.928: e/androidruntime(25485): @ android.os.handler.dispatchmessage(handler.java:92) 07-17 20:30:13.928: e/androidruntime(25485): @ android.os.looper.loop(looper.java:137) 07-17 20:30:13.928: e/androidruntime(25485): @ android.app.activitythread.main(activitythread.java:4921) 07-17 20:30:13.928: e/androidruntime(25485): @ java.lang.reflect.method.invokenative(native method) 07-17 20:30:13.928: e/androidruntime(25485): @ java.lang.reflect.method.invoke(method.java:511) 07-17 20:30:13.928: e/androidruntime(25485): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1038) 07-17 20:30:13.928: e/androidruntime(25485): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:805) 07-17 20:30:13.928: e/androidruntime(25485): @ 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): @ java.lang.reflect.method.invokenative(native method) 07-17 20:30:13.928: e/androidruntime(25485): @ java.lang.reflect.method.invoke(method.java:511) 07-17 20:30:13.928: e/androidruntime(25485): @ 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 message 07-17 20:30:13.928: e/androidruntime(25485): @ android.util.log.println_native(native method) 07-17 20:30:13.928: e/androidruntime(25485): @ android.util.log.d(log.java:155) 07-17 20:30:13.928: e/androidruntime(25485): @ com.example.flinkdownloadmanager.downloadservice.downloadfile(downloadservice.java:87) 07-17 20:30:13.928: e/androidruntime(25485): @ com.example.flinkdownloadmanager.mainactivity.downloaditem(mainactivity.java:115) 07-17 20:30:13.928: e/androidruntime(25485): ... 14 more
and code downloader
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()); } }
Comments
Post a Comment