Reputation: 1977
I want to delete my sqlite database when the application closes. I tried using a global class and overidded the onTerminate() method.
public class AppController extends Application {
private static AppController mInstance;
public Context context(){
return mInstance.getApplicationContext();
}
@Override
public void onTerminate() {
context().deleteDatabase(DbHelper.DATABASE_NAME);
super.onTerminate();
}
}
Its not working
Upvotes: 0
Views: 522
Reputation: 152927
For an in-memory database that is not persisted to permanent storage, use null
as the database file name.
Upvotes: 5