int getRecordCount(long id){ SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.rawQuery( String.format("SELECT COUNT(*) FROM %s WHERE %s = %d", TABLE_NAME, COLUMN_ID, id), null); int count = 0; if(cursor.moveToNext()){ count = cursor.getInt(0); } cursor.close(); db.close(); return count; }
0 件のコメント:
コメントを投稿