Question and answer is powered by AnsPress.io
I am creating a application in android. In this application I am using sqllite for storing data. I am new in android with sqllite. I want to count no. of rows. How can I do this?
Count row in sqllite in Android.
public int getRowCount(){ SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor= db.rawQuery("SELECT * FROM " + TABLE_NAME); cursor.moveToFirst(); int count= cursor.getInt(0); cursor.close(); return count; }