Using ormlite with a preopulated database

557 views
Skip to first unread message

Tim Drew

unread,
May 25, 2012, 12:40:33 PM5/25/12
to ormlite...@googlegroups.com
Hi all,

First of all ormlite is awesome, big thanks, it makes android development sooo much easier.

The issue I'm having is that I would like to use a small prepopulated database file with ormlite but haven't been able to get it to work.

Upon first run of an app I'm copying an existing database from my apk assets folder to the location where ormlite would usually create its fresh database. I was hoping ormlite would just pick it up an run with it but unfortunately I'm still getting onCreate() firing in my SQLiteOpenHelper.

I'm pretty sure that the copied database's compatibility/integrity is intact as it is one that ormlite created in the first place, I just copied it off an emulator via DDMS and haven't made any changes.

Is there anything ormlite specific that I might have missed?

Cheers,
Tim

jc

unread,
May 25, 2012, 8:29:37 PM5/25/12
to ORMLite Android Users

Tim Drew

unread,
May 28, 2012, 5:58:08 AM5/28/12
to ormlite...@googlegroups.com
Brilliant,

Got it working now, my own implementation was pretty much there, looks like I just needed to do a 

getWritableDatabase().close(); before performing the copy.

Much appreciated.

Reply all
Reply to author
Forward
0 new messages