I have below format json data:
[
[
{
"jsonObject":"jsonObject",
"jsonObject":"jsonObject",
"jsonObject":"jsonObject"
},
{
"jsonObject1":"jsonObject1",
"jsonObject1":"jsonObject1",
"jsonObject1":"jsonObject1"
}
],
[
{
"jsonObject2":"jsonObject2"
},
{
"jsonObject2":"jsonObject2"
}
]
]
How i get this json format and set into listview using volley i tried below code but i am not getting any object:
{
JsonArrayRequest request = new JsonArrayRequest(Request.Method.POST, SUBSCRIPTION_Url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
if (response.equals("success")) {
} else {
try {
for (int i = 0; i < response.length(); i++) {
JSONArray ja = (JSONArray) response.get(i);
JSONObject jb = (JSONObject) ja.get(i);
title_array_sub.add(jb.getString("payment_id").toString());
notice_array_sub.add(jb.getString("period").toString());
title1_array_sub.add(jb.getString("renewal_date").toString());
notice1_array_sub.add(jb.getString("auto_renewal").toString());
invoice_array_sub.add(jb.getString("invoice").toString());
adapter1 = new CustomBaseAdapter(Transaction.this, title_array_sub, notice_array_sub,
title1_array_sub, notice1_array_sub, invoice_array_sub);
list2.setAdapter(adapter1);
}
} catch (JSONException e1) {
} catch (ParseException e1) {
e1.printStackTrace();
}
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> map = new HashMap<String, String>();
map.put(KEY_MOVIE_ID, user_id);
map.put(KEY_USER_ID, User_type);
Log.d("movie_on_description", String.valueOf(map));
return map;
}
};
RequestQueue requestqueue = Volley.newRequestQueue(Transaction.this);
requestqueue.add(request);
}
Please Help i also try without using loop and getting value in single string with 0 index and i am getting value but not getting values while using loop. Thankyou