I am decoding the response in JSON , and I want to show that data in ListView
, how can I do this task? . I leave my progress.
public void onResponse(String response) {
System.out.println("INFORMACIÓN OBTENIDA DE LA BASE DE DATOS:");
//Crear un Objeto JSON a partir del string response
Object jsonObject = JSONValue.parse(response.toString());
//Convertir el objeto JSON en un array
JSONArray array = (JSONArray) jsonObject;
ArrayList<Usuarios> list = new ArrayList();
List<String> al = new ArrayList<String>();
//Iterar el array y extraer la información
for (int i = 0; i < array.size(); i++) {
JSONObject row = (JSONObject) array.get(i);
String nombre = row.get("usuario").toString();
String conexion= row.get("conexion").toString();
System.out.println("Usuario: " + nombre + " ||
Conexion: " + conexion);
al.add(nombre);
al.add(conexion);
}
ListView d = (ListView) findViewById(R.id.listView);
}