Or you could do it in pedestrian mode and extend SQLiteOpenHelper yourself.
public void createDataBase() throws IOException {
boolean dbExist = checkDataBase();
if (dbExist) {
// do nothing - database already exist
} else {
// By calling this method and empty database will be created into
// the default system path
// of your application so we are gonna be able to overwrite that
// database with our database.
this.getReadableDatabase();
try {
copyDataBase();
} catch (IOException e) {
throw new Error("Error copying database");
}
}
}
On Friday, June 29, 2012 6:38:58 AM UTC-4, Mark Murphy (a Commons Guy)
wrote:
>
> On Fri, Jun 22, 2012 at 7:46 AM, Neil <[email protected]> wrote:
> > Is there a way that we can create a Database file containing our words,
> > during development and then use that database within the app, rather
> than
> > having to build the database on first launch?
>
> Yes. Use SQLiteAssetHelper to package a SQLite database in assets/ and
> unpack it automatically on first run:
>
> https://github.com/jgilfelt/android-sqlite-asset-helper
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.7 Available!
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en