android Volley how to post multiple parameters -


how post multiple parameter android volley ** post multiple array 101,102,103 params.put("sessionid", 101,102,103); //as ** other way

    public void postcompanyarticle() {     stringrequest stringrequest = new stringrequest(request.method.post, config.postarticletopbiz(), new response.listener<string>() {         @override         public void onresponse(string response) {             list = parseresponse(response);             adapter.setlist(list);         }     }, new response.errorlistener() {         @override         public void onerrorresponse(volleyerror error) {             errorjson.setvisibility(view.visible);             string msg = volleyexception.geterrormessagefromvolleyerror(error);             errorjson.settext(msg);         }     }) {         @override         protected map<string, string> getparams() throws authfailureerror {             map<string, string> params = new hashmap<>();             params.put("sessionid", 101,102,103);//as             params.put("entid", "7");             params.put("offset", string.valueof(countview));             params.put("limit", "10");             params.put("lastlogintime", "2016-02-01");             return params;         }      };     requestqueue.add(stringrequest); } 

just use loops , works fine.

@override     protected map<string, string> getparams() throws authfailureerror {         map<string, string> params = new hashmap<>();         for(int i=0; < arraylist.size; i++)         {         params.put("sessionid["+i+"]",string.valueof(arraylist.get(i)));         }         params.put("entid", "7");         params.put("offset", string.valueof(countview));         params.put("limit", "10");         params.put("lastlogintime", "2016-02-01");         return params;     } 

arraylist list of sessionid. works me.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -