Dummy Question - Attaching DB for use

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Dummy Question - Attaching DB for use

Postby luthepa1 » Tue Dec 01, 2009 4:21 am

Hi,

this will probably sound real stupid but I have made a android project that will work with sqlite database. I have code to create a new Db when one does not exist, and I notice when looking on the emulator filesystem, the new Db will be created under "/data/data/projectname/databases". That's fine. But now I have a Db that I have added basic data to and want to add this to the project for the application to use at runtime. So my question is this (3-parts)

1. Will my attached Db be in same location as stated above if I add it to a folder "databases" under the "res" folder?
2. Or would I need to perform file system command to move it to the location stated above, or code the location into my project.
3. Or could I only reference to it via the R class?

Sorry if this is obvious but I am a newbie.

Thanks.
luthepa1
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Oct 14, 2009 11:51 pm

Top

Postby THRESHE » Sun Dec 13, 2009 11:45 am

I have the same problem :shock: Still didn't find any solution. Maybe a database should be copied somewhere to be used (like on iPhone)
Last edited by THRESHE on Sun Dec 13, 2009 5:59 pm, edited 1 time in total.
THRESHE
Freshman
Freshman
 
Posts: 5
Joined: Sun Dec 13, 2009 11:38 am

Postby luthepa1 » Sun Dec 13, 2009 1:12 pm

In the end I changed my mind and just added to my DbAdapter class to populate my db with the default data I wanted as it was not much anyway. And I execute this in the onCreate method for when a new db is created for first time use of the app I am writing.

I did find this post however (http://osdir.com/ml/AndroidDevelopers/2 ... 01546.html) which basically is like other info I found on net that you would need to add your db to your /res/raw folder of resources and then use file stream to save that resource to the android file system at a location of your choice. Would be nice if you could add a db to our application resources and on execution it automatically distributed to the application default data package directory like I stated in my first post above. Unless someone knows that this can be done in eclipse? We'd be grateful to know.
luthepa1
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Oct 14, 2009 11:51 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 7 guests