Someone would have an example of Listview
with cursorAdapter
.
I have a listview
that takes two fields from a Sqlite database, and two buttons in each row.
Please, I need help.
private void recuperarTodasPersonas() {
try {
baseDatos = new DatabaseHandler(this);
// Devuelve todas las personas en el objeto Cursor.
Cursor cursor = baseDatos.obtenerTodasPersonas();
String[] from = new String[]{
"nombre",
"apellido",
};
int[] to = new int[]{
R.id.Nusuario,
R.id.Ausuario,
};
cursorAdapter = new ImagenAdapter(this, cursor, from, to);
listViewPersonas.setAdapter(cursorAdapter);
} catch(Exception e) {
Log.d("Error", "El mensaje de error es: " + e.getMessage());
} finally {
// Se cierra la base de datos.
baseDatos.cerrar();
}
}
I just need the fields Nombre
and Apellidos
. I do not know how I have to form the from
and the to
to show me the list.