Thank you for your reply.

I have created my own sqlite file from the command prompt. To access this
database in an Android app, I should use content provider - is that what
you are saying ?
But I thought for using content provider, I create my own database using
SQL statements in my Java code. So I cannot use my already present sqlite
file ?

I am sorry for the naive quetsions. I am very new to this.

Thanks.

On Wed, Jan 25, 2012 at 6:22 PM, Roger Binns <rog...@rogerbinns.com> wrote:

> -----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
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to