Saturday, October 31, 2009

[android-developers] Re: Including extra sqlite databases?

Thanks Ian, I also found this writeup on the subject as you're
describing it:

http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/


On Oct 31, 1:49 pm, Ian Guedes Maia <iangm...@gmail.com> wrote:
> Add it o assets/ and write it to the filesystem when the application
> loads for the first time or when you do the first database access (you
> can do that easily using a class that extends SQLiteOpenHelper to
> create the database if it doesn't exist yet). Use
> context.getDatabasePath(DB_NAME) to get the location where you can
> create the file of your database.
>
> 2009/10/31 Mark Wyszomierski <mar...@gmail.com>:
>
>
>
> > Hi Mark,
>
> > Yeah I think I need to write it to a local file, SQLiteDatabase has
> > constructors which only read from a file path, or File instance.
>
> > I'm wondering though if I can stick it in res/raw and read it straight
> > from there. Some examples like:
>
> >  http://www.anddev.org/working_with_files-t115.html
>
> > I've added the sqlite file to my raw folder, it appears in my .R file,
> > however eclipse intellisense cannot resolve it when I type
> > R.raw.mydatabase - odd -
>
> > Thanks
>
> > On Oct 31, 7:42 am, Mark Murphy <mmur...@commonsware.com> wrote:
> >> Mark Wyszomierski wrote:
> >> > I have some external sqlite files I'd like to include with my app. It
> >> > looks like I can add them to the /assets folder, then read them from
> >> > there? Is the /assets folder the appropriate location for them?
>
> >> assets/ is a fine spot for packaging them, but I don't think you can
> >> read them from there. I suspect you will need to copy them out of the
> >> APK into a regular file somewhere, then use that copy.
>
> >> --
> >> Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> >> _Beginning Android_ from Apress Now Available!
>
> > --
> > 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+unsubscribe@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment