0
I was able to save information in my Sqlite bank, only I can’t call them.
I’m trying to use the following method:
private void verPessoas() {
ArrayList<RespostasAguaCasa> pessoas = new Read().getLista();
for (int i = 0; i < pessoas.size(); i++) {
RespostasAguaCasa p = pessoas.get(i);
int a = p.getValoragua();
impri.setText("+"+ a);
}
if (pessoas.size() == 0) System.out.println("# Não existe valor .");
}
READ
public class Read {
public ArrayList<RespostasAguaCasa> getLista() {
SQLiteDatabase db =
Maindb.getInstancia().getWritableDatabase();
String query = "SELECT * FROM " + Maindb.TABELA;
ArrayList<RespostasAguaCasa> lista = new ArrayList<>();
Cursor c = db.rawQuery(query, null);
if (c.moveToFirst()) {
do {
RespostasAguaCasa resp = new
RespostasAguaCasa(c.getString(0));
resp.setId(c.getInt(1));
resp.setValoragua(c.getInt(2));
resp.setAcordarhora(c.getInt(3));
resp.setAcordarminu(c.getInt(4));
resp.setDormirhora(c.getInt(5));
resp.setDormirminu(c.getInt(6));
lista.add(resp);
}
while (c.moveToNext());
{
}
}
c.close();
return lista;
}
}
I took a look it helped me really thank you
– aleander rayson