android - NetworkDispatcher.run: Unhandled exception java.lang.NullPointerException -
i trying run below code send request on web server api using volley library make web server hit functions. check code , tell ma problem
private void makeloginrequest(string memail, string mpassword) { string urljsonobj = constants.weburls.baseurl + constants.baseurlprefix.dgetlogin; showpdialog(); map<string, string> params = new hashmap<string, string>(); params.put("email", memail); params.put("password", mpassword); params.put("signature", utility.getmd5signaturemain(this)); params.put("ts", utility.gettimestamp()); params.put("client_id", constants.clientid); params.put("platforms", constants.plateform); appcontroller.getinstance().getsharedprefrence().getprefskeyobjectid(this)); params.put("parse_installation", appcontroller.getinstance().getsharedprefrence().getdprefskeyinstallationid(this)); customrequest jsobjrequest = new customrequest(request.method.post, urljsonobj, params, this.createrequestsuccesslistener(), this.createrequesterrorlistener()); } public response.listener<jsonobject> createrequestsuccesslistener() { response.listener<jsonobject> reponselistener; reponselistener = new response.listener<jsonobject>() { @override public void onresponse(jsonobject jsonobject) { try { if (jsonobject != null) parselogin(jsonobject); else{ log.e("abc","def"); } } catch (jsonexception e) { e.printstacktrace(); } hidepdialog(); } }; return reponselistener; } response.errorlistener createrequesterrorlistener() { response.errorlistener errorlistener; errorlistener = new response.errorlistener() { @override public void onerrorresponse(volleyerror volleyerror) { volleyerror.printstacktrace(); hidepdialog(); if (volleyerror.networkresponse == null) { if (volleyerror.getclass().equals(timeouterror.class)) { // show timeout error message toast.maketext(dloginactivity.this, "oops. timeout error!", toast.length_short).show(); } if ( volleyerror.getclass().equals(noconnectionerror.class)) { // show timeout error message toast.maketext(dloginactivity.this, "no internet connection! try again later", toast.length_short).show(); } } } }; return errorlistener; }
but getting following error:
e/volley: [4189] networkdispatcher.run: unhandled exception java.lang.nullpointerexception java.lang.nullpointerexception @ libcore.net.uricodec.encode(uricodec.java:132) @ java.net.urlencoder.encode(urlencoder.java:57) @ com.android.volley.request.encodeparameters(request.java:449) @ com.android.volley.request.getbody(request.java:435) @ com.android.volley.toolbox.hurlstack.addbodyifexists(hurlstack.java:236) @ com.android.volley.toolbox.hurlstack.setconnectionparametersforrequest(hurlstack.java:210) @ com.android.volley.toolbox.hurlstack.performrequest(hurlstack.java:106) @ com.android.volley.toolbox.basicnetwork.performrequest(basicnetwork.java:93) @ com.android.volley.networkdispatcher.run(networkdispatcher.java:110)
i have no idea problem. can help? in advance.
Comments
Post a Comment