Prachi
Prachi

Reputation: 1004

How can we drop a database in android?

How can we drop a database in android?

Upvotes: 2

Views: 2969

Answers (2)

Avishek
Avishek

Reputation: 81

This is going to be a very late reply to this post, but if anyone else is facing the same issue, can try the following.

myContext.deleteDatabase(DB_NAME);

Upvotes: 2

user604243
user604243

Reputation:

This should work:

private SQLiteDatabase db;
private static final String TABLE_NAME = "name_of_table";

try {
  db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
  db.execSQL("VACUUM");
} catch (SQLException sqle) {....}

Upvotes: 2

Related Questions