Good I have this query to an external url, the results realize the set and get to a recycler. The issue is that I need to make two more queries of this style. How could I achieve these consultations in the same class? Thanks
private void CargarPreguntas() {
String url="/app/consultarPartidas.php?CodUsua="+ CodUsua;
JsonObjectRequest jsonObjectResquest = new JsonObjectRequest(Request.Method.GET, url, null, this, this);
VolleySingleton.getIntanciaVolley(getContext()).addToRequestQueue(jsonObjectResquest);
}
public void onErrorResponse(VolleyError error) {
Toast.makeText(getContext(), "ERROR", Toast.LENGTH_SHORT).show();
Log.i("ERROR",error.toString());
}
public void onResponse(JSONObject response) {
jsonPartidas jsonPartidas = null;
JSONArray json = response.optJSONArray("contrincantesPendientes");
try {
for(int i=1;i<json.length();i++) {
jsonPartidas = new jsonPartidas();
JSONObject jsonObject = null;
jsonObject = json.getJSONObject(i);
jsonPartidas.setName(jsonObject.optString("contrincante"));
jsonPartidas.setEstado(jsonObject.optString("estado"));
jsonPartidas.setCodPart(jsonObject.optString("CodPart"));
listaRetos.add(jsonPartidas);
}
retosPendientes adapter = new retosPendientes(listaRetos, getContext());
RetosPendientes.setLayoutManager(new LinearLayoutManager(getContext()));
RetosPendientes.setAdapter(adapter);
} catch (JSONException e) {
e.printStackTrace();
}
}