Content Providers and Database initialisation

by Gavin Aiken » Wed, 18 Feb 2009 20:54:14 GMT

Sponsored Links
I have a plethora of data which is currently stored in 1000 different very
small text files, I want to store this data in an SQLite database as I feel
that this will be more space efficient and hopefully time efficient as I
presume a database query is faster than opening and parsing a text file
(please stop me now if this isn't the case!).

The data does not need to be available to other applications and will be
used internally only. My first question is whether or not to create a
content provider anyway, is there any benefit to this?

My second question is where to initialize the database, is it possible to
ship an application with a database included already populated? Do I have to
populate it in the onCreate method of the SQLiteOpenHelper subclass? If I
have to include the 1000 text files and read, parse and insert the data at
install time I have a feeling this would be slow. Is it possible for me to
populate the database now, dump it to a single file and then bulk insert
from the file in the onCreate method?

I hope you get the jist of what I mean!

Many thanks,



Content Providers and Database initialisation

by daekpony » Fri, 06 Mar 2009 09:01:14 GMT

 hi there - did you ever get an answer to whether you can ship an
application with the database already populated? If you can, would you
mind sharing the steps to do so with us?



Sponsored Links

Content Providers and Database initialisation

by Justin Allen Jaynes » Sat, 07 Mar 2009 11:35:49 GMT

 I had a similar question and Alistair Rutherford shared this article 
link with me.  It's exactly what I was looking for and may help you as well. 



Other Threads

1. Recycling of _ID field in SMS Table

   I've just found out that _ID field is not always unique in SMS table and
gets repeated after some days. Is it normal or some bug ? Can someone tell
what is threshold before _ID field is repeated. Actually i have implementing
a logic thinking that _ID field is always unique in all records i.e SMS,
Call logs, Contacts etc but now discovered that it is not guaranteed to be
always unique in SMS messages. I didn't check for contacts , call logs etc
but it is true for SMS messages.

Suppose a SMS messages had _ID field equal to 1. But after some days that
message is deleted so now 1 is not assigned to any message as id, will the
system assign that id to some new message whenever it wants to ?



2. Making a request over mobile network when WiFi is enabled

This is why Tethering requires rooted phones; you cannot have both radio's
active at once.

The only solution I can think of is to request sufficient permissions for
your app that you can turn WIFI off temporarily, let the 3G boot and use it.

Of course people would lose their WIFI if it's being used.
Makers of PhoneMyPC


3. Arbitrary positioning icon on a View

4. bluetooth connect process

5. Android presentation at Linux Solutions Paris 2010

6. Orange is looking for great Apps

7. Installing daemon with root permissions