Get
String url = commoninterfaceurl.comm_getworksdetailurl + "/" + Worksid; Requestqueue mqueue = Volley.newrequestqueue (MyApplication.mInstance.getApplicationContext ()); Stringrequest stringrequest = new Stringrequest (url,new response.listener<string> () {@Overridepublic void Onresponse (String response) {}, New Response.errorlistener () {@Overridepublic void Onerrorresponse (volleyerror error) { if (Utilscheck.checkvolleynewwork (Error.getmessage ())) {Toastutils.showshort (r.string.not_network);} else { Toastutils.showshort (R.string.not_get_data);}}); Mqueue.add (stringrequest);
Post
String url = commoninterfaceurl.comm_saveattentionurl; Requestqueue mqueue = Volley.newrequestqueue (MyApplication.mInstance.getApplicationContext ()); Stringrequest stringrequest = new Stringrequest (method.post,url,new response.listener<string> () {@ overridepublic void Onresponse (String response) {LOG.D ("TAG", Response);}}, New Response.errorlistener () {@ overridepublic void Onerrorresponse (volleyerror error) {LOG.E ("TAG", Error.getmessage (), error);}) {@Overrideprotected map<string, string> getparams () throws Authfailureerror {map<string, string> Map = new Ha Shmap<string, String> (), Map.put ("UserName", "AAAA"), Map.put ("Password", "bbbb"); return map;}; Mqueue.add (stringrequest);
Volley Get Post method