android - pass array data as parameter volley -
i have array this
arrayname[{"code" : "abc","code2":"cba",}]
i want send paramaters,put in getparam() function volley server
the problem similiar
any how it?
thanks in advance
for this, have make jsonarrayrequest. in volley there jsonarrayrequest class use 1 jsonarray request.
this method available in jsonarrayrequest class.
public jsonarrayrequest(int method, string url, jsonarray jsonrequest, listener<jsonarray> listener, errorlistener errorlistener) { super(method, url, (jsonrequest == null) ? null : jsonrequest.tostring(), listener, errorlistener); }
may you:
jsonarray jarrayinput=new jsonarray(); jsonobject jobjectinput=new jsonobject(); jobjectinput.put("code", abc); jobjectinput.put("code2", cba); jarrayinput.put(jobjectinput); jsonarrayrequest request = new jsonarrayrequest(method.post, /*your base url*/, jarrayinput , new response.listener<jsonarray>() { @override public void onresponse(jsonarray response) { //here success response } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { //here error response } }); myvolley.getrequestqueue().add(request);
Comments
Post a Comment