0

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?

3
  • deleteDatabase() has been around since API 1. Are you using Context.deleteDatabase( String ) -- a static call --, or this.deleteDatabase( String )? deleteDatabase() is not static. Commented May 12, 2014 at 18:03
  • nothing appears when I write Context.deleteDatabase( string ) Commented May 12, 2014 at 18:06
  • No, nothing should appear. There's no static method deleteDatabase() on Context. Post your code. Commented May 12, 2014 at 18:09

1 Answer 1

1
SQLiteDatabase db = helper.getWritableDatabase(); 
//helper is object extends SQLiteOpenHelper
db.delete(DatabaseHelper.TAB_USERS, null, null);
db.delete(DatabaseHelper.TAB_USERS_GROUP, null, null);
Sign up to request clarification or add additional context in comments.

1 Comment

@AnixPasBesoin, sure you can. Why do you think you can't?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.