سؤال

I want to clear my SQLite database by deleting the associated db file and then recreating it.

However, I can't use context.deleteDatabase() for I'm working with the min API 10.

Any alternatives?

هل كانت مفيدة؟

المحلول

SQLiteDatabase db = helper.getWritableDatabase(); 
//helper is object extends SQLiteOpenHelper
db.delete(DatabaseHelper.TAB_USERS, null, null);
db.delete(DatabaseHelper.TAB_USERS_GROUP, null, null);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top