how to do mutliple array in volley????

456 views.

how to do mutliple array in volley????

Asked on May 23, 2017 in android.
Add Comment
1 Answer(s)
241 views.

JsonObjectRequest objectRequest=new JsonObjectRequest(Request.Method.POST, url, obj,
 new Response.Listener<JSONObject>() {
 @Override
 public void onResponse(JSONObject response) {
 try {
 JsonArray array1=response.getJsonArray("array1");
 for(int i=0;i<array1.length();i++){
 JsonObject o=array1.getJSONObject(i);
 }
 JsonArray array2=response.getJsonArray("array2");
 for(int j=0;j<array2.length();j++){
 JsonObject o=array2.getJSONObject(i);
 }
 } catch (JSONException e) {
 e.printStackTrace();
 }
 }
 },
 new Response.ErrorListener() {
 @Override
 public void onErrorResponse(VolleyError error) {
 Log.e("Error",""+error);
 }
 });
 mRequestQueue.add(objectRequest);
 }
}
Answered on May 26, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.