2
Caused by: java.lang.Nullpointerexception AT dao.Database.verificaSeTemRegistroNaTable(Database.java:184)
That error was presented in mine logcat
.
The method:
public boolean verificaSeTemRegistroNaTabela(String tabela){
String sqlSelect = "SELECT * FROM '" + tabela + "'";
Cursor res = db.rawQuery(sqlSelect, null);
if (res.getCount() > 0){
return true;
}
return false;
}
Line with error:
Cursor res = db.rawQuery(sqlSelect, null);
Check if it’s not the db that ta null, as you are calling this method check?
– Leonardo Dias
What is the type of
db
. Are you sure it’s not null?– Jéf Bueno
Read this: injection of SQL.
– Victor Stafusa
remove the single quotes
String sqlSelect = "SELECT * FROM " + tabela;
and check the variabledb
– novic