-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 25/01/12 14:31, Lavanya Ramanan wrote:
> What am i missing?

The SQLite Java wrapper in Android automatically creates the directory
when you use it to create a database.  Since you are bypassing that you'll
need to create the directory yourself manually.

However I'd advise you against this whole approach.  There are more behind
the scenes fields now (eg user version), and the approach taken will be
brittle for future changes in the Android platform.

You can store the raw data in your assets and then populate the database
on first use.  The data format used in your assets can be optimised for
its usage as you'll only be reading from it sequentially (eq SQL text,
CSV, binary, compressed, incrementing field omitted, de-normalized).

You can expose data as a ContentProvider instead of as SQLite.  Your
content provider can then combine/augment/override the assets data and the
database as is appropriate.

If you do still want to do a file copy then the most compatible approach
is to create the database in an emulator running your oldest supported
Android version (minSdkVersion) as that will ensure all needed behind the
scenes fields are present and Android will know how to upgrade when used
on more recent versions.

Make sure you use SQLiteOpenHelper for your database usage as it will make
managing installs/upgrades etc easier.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk8gjrEACgkQmOOfHg372QTyiQCfd/eg2CMd9Xa/1hYlqFeb6OI5
DS8AoKQ3WzdYgVTtA0rs2JK6GJtlgnTP
=O1jv
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to