I'm trying to integrate the nested array response from the api into nested recyclerview in android I integrate the response but i couldn't get values from the response.` private void loadJson() { //creating a string request to send request to the url StringRequest stringRequest = new StringRequest(Request.Method.GET, myUrl, new Response.Listener() {
@Override
public void onResponse(String response) {
Toast.makeText(getApplicationContext(), "The response is" + response, Toast.LENGTH_LONG).show();
try {
Toast.makeText(getApplicationContext(), "The Response is" + response, Toast.LENGTH_LONG).show();
//getting the whole json object from the response
JSONObject emp=(new JSONObject(response)).getJSONObject("getquestions");
String empname=emp.getString("name");
int empid=emp.getInt("id");
Toast.makeText(getApplicationContext(), "the question name is"+empname, Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "the question id is"+empid, Toast.LENGTH_SHORT).show();
/* JSONObject movieObject = new JSONObject(response);
String title = movieObject.getString("q_name");
Log.e("question","-->"+title);*/
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
}
});
RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
requestQueue.add(stringRequest);
}
`