I looked for this on SO and saw this(and others like it): sql direct way to get number of rows in table, however, Select is shown as a token as is count. I tried to use mDb.execSQL() but that only returns void. Any help on how to do this would be appreciated. The code is:
public int getRowNumber(){ return mDb.execSQL(“SELECT COUNT(*) FROM notes”);} I get an error that says “cannot return void result”.
I looked for this on SO and saw this(and others like it): sql direct
Share
The error you’re getting means your method can’t return
void.execSQLitself returns a void, and you’re returning that same void from your own method which is declared to return an int:d.android.com link for reference.
I know you already accepted, but here’s a quick & dirty test method that does what you sort of need to do: