Android examples for Database:Cursor
check database Table Exist by counting Cursor
//package com.book2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static boolean checkTableExist(SQLiteDatabase db, String tableName) {// ww w .ja va 2 s .c o m Cursor c = db.rawQuery( "SELECT * FROM sqlite_master WHERE type='table' " + "AND name='" + tableName + "';", null); try { return c.getCount() > 0; } finally { c.close(); } } }