So I can use an excel/csv file as input to the content provider? Where do I place the file?
And I would also like to know what GUI do people generally use for sqlite database. Thanks. Lavanya On Fri, Jan 27, 2012 at 1:57 PM, Lavanya Ramanan <lavanyacoo...@gmail.com>wrote: > > > ---------- Forwarded message ---------- > From: Roger Binns <rog...@rogerbinns.com> > Date: Thu, Jan 26, 2012 at 12:47 PM > Subject: Re: [sqlite] Query on Sqlite3 in an Android app > To: sqlite-users@sqlite.org > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 26/01/12 09:15, Lavanya Ramanan wrote: > > 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 ? > > No. What I am saying is that if you are providing data to other > components, code or applications then the natural Android way of doing so > is to use a ContentProvider not a raw SQLite database. Note that this > applies even within the same app. > > The code that implements a ContentProvider can combine a SQLite database, > defaults shipped with your app and whatever else is appropriate in order > to supply the data returned by a content provider. > > http://developer.android.com/guide/topics/fundamentals.html > > > 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 ? > > Your application is installed as an APK file which is ultimately a single > zip file with designated contents. Assets bundled with the app are also > just files within that zip file. Since you won't be able to open a SQLite > database embedded within that zip file you'll have to take another > approach out of the following: > > 1: Create the database on the oldest Android version you support > (minSdkVersion). This ensures that the extra fields Android cares about > are present. Copy the database from assets to the file system and then > use the database. > > 2: Store the data but not a database in the assets. This could take the > form of SQL statements, CSV, binary or other appropriate encoding. Use > that data to populate the database on first use. > > 3: In your ContentProvider combine/augment/override the data stored in the > assets with a database (ie no copying from assets to filesystem) > > And finally: > > > 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) > > iEYEARECAAYFAk8hkb8ACgkQmOOfHg372QSzxACgpqflc6Z40l6R0AQ1D642o6DC > cUQAn2jqqHjvWLz3i+ao6koInLVIPgtz > =LoEz > -----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