[android-developers] Re: SQLite setup
But be wary of the 1MB "gotcha" -- if the file is over 1MB you need to name it ".jpg" or some such to prevent compression. On Jan 2, 9:55 pm, Sarwar Erfan wrote: > Put your pre-created and pre-populated database in assets. Then, copy to > proper place in the first run (or when the db is not found where it > was supposed to be copied. > This link helped > me:http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-and... > > There are other examples available, try googling. > > Regards > Sarwar Erfan -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: SQLite setup
On Mon, Jan 3, 2011 at 1:50 PM, Pedro Duque wrote: > I've read about prepopulting the database and looked good to me but I got > worried about database upgrades... > No easy way to do upgrades. Check version on startup and download if newer version is available is probably your best bet. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: SQLite setup
I've read about prepopulting the database and looked good to me but I got worried about database upgrades... On 3 de Jan de 2011, at 04:20, Zsolt Vasvari wrote: > Creating 400 reconds should take no more than a few seconds if you > bracket using transactions. It won't overload the system by any > stretch of the imagination. > > Whether to go with the asset or create the database "on-the-fly" > should depend on your app, but either way is fine. > > > On Jan 3, 11:49 am, Pedro Duque wrote: >> Hi, >> >> I need to use a SQLite database in my app (eventually create a Content >> Provider) but I'm not really sure how to setup that database. All examples I >> saw, the database is created "on the fly" by issuing a SQL command on the >> event onCreate of SQLiteOpenHelper and populating it. >> >> I need to feed the database with almost 400 records to start but it seems >> too messy to create a 29Kb string to populate the database. Isn't there a >> more elegant way to do it that won't overload the system (I tried to create >> a resource with that string...). >> >> Any thoughts? >> >> Thanks, >> Pedro Duque > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: SQLite setup
Creating 400 reconds should take no more than a few seconds if you bracket using transactions. It won't overload the system by any stretch of the imagination. Whether to go with the asset or create the database "on-the-fly" should depend on your app, but either way is fine. On Jan 3, 11:49 am, Pedro Duque wrote: > Hi, > > I need to use a SQLite database in my app (eventually create a Content > Provider) but I'm not really sure how to setup that database. All examples I > saw, the database is created "on the fly" by issuing a SQL command on the > event onCreate of SQLiteOpenHelper and populating it. > > I need to feed the database with almost 400 records to start but it seems > too messy to create a 29Kb string to populate the database. Isn't there a > more elegant way to do it that won't overload the system (I tried to create > a resource with that string...). > > Any thoughts? > > Thanks, > Pedro Duque -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: SQLite setup
Put your pre-created and pre-populated database in assets. Then, copy to proper place in the first run (or when the db is not found where it was supposed to be copied. This link helped me: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ There are other examples available, try googling. Regards Sarwar Erfan -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en