Reputation: 1305
I used this reference to copy over a database I have:
Using your own SQLite database in Android applications
But when the database is copied over and I remove the database file from my assets folder and run my app it still reads the database. So what I have been doing is renaming the db file and running it again for testing purposes. I don't like this cause I feel its taking up unnecessary space. But I was wondering if I can somehow delete the database that was copied over so I wont have to keep renaming. Anyone know?
Upvotes: 0
Views: 145
Reputation: 2600
Try renaming the database in your assets folder, but don't forget to change the name in your DbHelper as well!
Upvotes: 0
Reputation: 9994
As far as I know you will not be able to delete it, but in this way you can generate a new one with changing the version :
private static class DatabaseHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1; // Increase ==> new empty DB created
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
}
In your code the version is 1, you can increase it and generate a new empty database.
Upvotes: 1