Content Providers and Database initialisation

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


Sponsored Links
 Hey,
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,

Gav

--~--~---------~--~----~------------~-------~--~----~



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?

thanks!



--~--~---------~--~----~------------~-------~--~----~


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.

 http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ 


Justin






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Application install unsuccessful after signing

I can not install my application after signing my application when I
try to download from my server. I keep getting the error "Application
install unsuccessful after signing" when I try to install it. It was
working before I signed it. I am not sure what I am doing wrong. I
have added the MIME type to the server as well.

I made my key using
C:\Program Files\Java\jdk1.6.0_10\bin>keytool -genkey -alias
myapp.keystore -keyalg RSA -validity 20000 -keystore keys/
myapp.keystore

I signed my application by using
C:\Program Files\Java\jdk1.6.0_10\bin>jarsigner -verbose -keystore
keys/myapp.keystore MyApp.apk myapp.keystore

I have double checked with the following
C:\Program Files\Java\jdk1.6.0_10\bin>jarsigner -verify myapp.apk
jar verified.

--~--~---------~--~----~------------~-------~--~----~

2. com.android.email - Should I stay or should I fork now?

Hiya,

I'm a new G1 owner.  I was pretty bummed out by the state of the built-
in POP/IMAP client, so I dusted off my JDK to start to set things
right, but I've hit a bit of a stumbling block.  I've added a few
features to make the mail app more usable for me. (Specifically, key
bindings for things like delete in the index view and propagating
message deletion back to an IMAP server)

The problem is that It appears that I can't remove or replace the
shipped Email application.

I'd like to use and share my 'improved' mail client. To do that, it
looks like I'd have to fork it, change the name and so on, so it can
peacefully co-exist on a production G1.

I'd really like to contribute my changes back to the core android
platform, but maintaining a renamed fork will make that less-than-fun.

So, what should I do?

-Jesse

--~--~---------~--~----~------------~-------~--~----~

3. Runtime exception with JSONObject.put() ???

4. Project looking for Android Developer/s

5. command line window in emulator

6. problem when adding Layout on MapView

7. getLayoutInflater().inflate