Android examples for Database:Table Row Query
count Database table row Number
//package com.book2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static int countDataNum(SQLiteDatabase db, String TABLE_NAME) { String sql = " select count(*) from " + TABLE_NAME; Cursor cursor = db.rawQuery(sql, null); cursor.moveToLast();//from w w w . j a va 2 s . co m int count = cursor.getInt(0); return count; } }