Java tutorial
//package com.java2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static int getGroupCount(SQLiteDatabase db) { int result = 0; // SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY); Cursor cursor = db.rawQuery("select count(*) from classlist;", null); cursor.moveToFirst(); result = cursor.getInt(0); cursor.close(); // db.close(); return result; } }