android sqlite get rows count 1

android sqlite get rows count

SQLiteDatabase db = this.getReadableDatabase();
long count = DatabaseUtils.queryNumEntries(db, TABLE_NAME);
db.close();

Here is what the above code is Doing:
1. Get a readable database
2. Use the DatabaseUtils class to get the number of rows in the table
3. Close the database

Similar Posts