1
I have a database in an application of android
, would like the name field in the table, fill the text
of TextView
. I saw some examples but I couldn’t implement, the getReadableDatabase().rawQuery(sqlNome, null);
is always in red, that is, I cannot use it. It is only a data that will be in the table.
Follow the code I tried to implement:
criaBanco = new CriaBanco(getBaseContext());
sqlNome = "select nome from tabela";
Cursor cursor = getReadableDatabase().rawQuery(sqlNome, null);
textView = (TextView) findViewById(R.id.txt1);
if (!criaBanco.NOME.isEmpty()) {
textView.setText(sqlNome);
}
else {
textView.setText("NOME");
}
cursor.close();
Won’t be
Cursor cursor = criaBanco.getReadableDatabase().rawQuery(sqlNome, null);
?– ramaral
@ramaral vc is correct. thanks. Put as an answer so you can mark it and put 1 vote.
– Henrique