Search code examples
androiddatabaseassets

Android: remove data from database


I am using this code (android-sqlite-asset-helper) to load a database from a file place in the asset folder. This works great.

However, the processing of refreshing/upgrading the database is not simple, and I am wondering if there is a simple way to manually remove all data from the databases in the app; in order to load a new database from the asset file.


Solution

  • It seems to work with this in the main activity creation:

    getApplicationContext().deleteDatabase("mydatabase.db");