i need make 2 requests different parameters, response , parameters volley. below code
private void loadfirst() { pdialog = new progressdialog(getactivity()); // showing progress dialog before making http request pdialog.setmessage("loading..."); pdialog.show(); final stringrequest userreq = new stringrequest(method.post, appconfig.url_register, jsonsubjectlistener, errorsubjectlistener) { @override protected map<string, string> getparams() { // posting params register url map<string, string> params = new hashmap<string, string>(); params.put("tag", "retrievefirst"); return params; } }; appcontroller.getinstance().addtorequestqueue(userreq); } } private void loadsecond(final string user_type) { // session manager session = new sessionmanager(getactivity().getapplicationcontext()); // initialising progress dialog pdialog = new progressdialog(getactivity()); // showing progress dialog before making http request pdialog.setmessage("loading..."); pdialog.show(); stringrequest userreq = new stringrequest(method.post, appconfig.url_register, jsonlistener, errorlistener) { @override protected map<string, string> getparams() { // posting params register url map<string, string> params = new hashmap<string, string>(); params.put("tag", "retrievesecond"); params.put("user_type", user_type); return params; } }; appcontroller.getinstance().addtorequestqueue(userreq); }
then called these 2 functions under onactivitycreated of fragment. kept on loading indefinitely. read on requestfuture can't see how can me 2 different parameters, errorlisteners , responselisteners. thanks
my take this. calling 2 methods each 1 this:
pdialog = new progressdialog(getactivity());
the second time instantiate progress dialog on same reference, old progress dialog still showing no longer reachable. it's not requests loading forever. it's can no longer dismiss first progress dialog. think need instantiate progress dialog once outside before both methods.
Comments
Post a Comment