drop database Table - Android Database

Android examples for Database:Table Drop

Description

drop database Table

Demo Code


//package com.book2s;
import android.content.Context;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    public static void dropTable(Context context, String tableName) {
        SQLiteDatabase db = getDatabase(context);
        db.execSQL("DROP TABLE " + tableName + ";");
        db.close();/* w ww.  j ava2 s.com*/
    }

    public static SQLiteDatabase getDatabase(Context context) {
        return context.openOrCreateDatabase("tomato.db",
                Context.MODE_PRIVATE, null);
    }
}

Related Tutorials