I export my application to .apk file, sign it and then install it. But when I run my app, it displays an error because there’s no data in my database.
The database was created as a new one when I installed the application, so all the data were lost!
How can I include database data when exporting an Android application?
Option #1: Package the database as a raw resource or asset, and use streams to copy that database to its proper position when the app is first run.
Option #2: Package SQL statements to populate the database as a raw resource, and execute those statements in your
SQLiteOpenHelper‘sonCreate()method.Option #3: Put the smarts straight in your Java code to populate your database in your
SQLiteOpenHelper‘sonCreate()method.Option #4: Download the database on first run and copy it to its proper position.
And so on.