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 <[email protected]>:
> 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 <[email protected]> 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 [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

-- 
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

Reply via email to