SQLite查询记录总数

public int getCount() {
  SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
  Cursor cursor = db.rawQuery("select count(id) from table",null);
  cursor.moveToFirst();
  Long count = cursor.getInt(0);
  cursor.close();
  return count;
 }

 

转载于:https://www.cnblogs.com/chenlong-50954265/p/4972215.html

你可能感兴趣的:(SQLite查询记录总数)