You can get rid of SQLiteAssetHelper and implement this DatabaseInitializer class that copies your db (if it does not exist) to data/data/yourapp/databases/yourdb.db (the folder where ormlite generates your db)
In your DatabaseHelper constructor:
public DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); DatabaseInitializer initializer = new DatabaseInitializer(context); try { initializer.createDatabase(); initializer.close(); } catch (IOException e) { e.printStackTrace(); } }
Clean and easy solution
Some minor cons:
- only works with Android 2.2.3+
- be careful with the size (did not encounter any problem with 3mb)
source share