Android and fairly large SQLite datafiles

Posted by SK9 on Stack Overflow See other posts from Stack Overflow or by SK9
Published on 2011-01-17T03:01:00Z Indexed on 2011/01/17 3:53 UTC
Read the original article Hit count: 192

Filed under:
|

I'm starting an Android project, a port from an existing iPhone project I've completed.

I have a fairly large read-only SQLite database, about 100Mb in all. It's called "mydata.sqlite". Where do I place this in my Eclipse workspace? It's too big for "assets".

Next, how do I best get at the file? I would think to try (handling exceptions later) something like:

SQLiteDatabase myDatabase = null;
myDatabase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);

But I would then need the path string myPath and since I don't know where to put the resource I don't know what this needs to be.

Can I put "mydata.sqlite" into "res/raw" (once I create "raw" in Eclipse?) and then referene it as a resource with "R.raw.mydata"?

I would very much appreciate some direct help here, rather than a reference to a tutorial. I have checked tons of these, including those that are already cited here on stackoverflow. I've also gone through the "Notepad" project in the Android developer documents. However these and the documentation typically consider only new, empty or small databases. This should be a simple thing and given the time I've spent already it is perhaps easier to ask.

Thanking you kindly in advance for your assistance.

© Stack Overflow or respective owner

Related posts about android

Related posts about sqlite