This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Android and the fly likes Newbie - Best practice for a new .db ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Newbie - Best practice for a new .db ?" Watch "Newbie - Best practice for a new .db ?" New topic
Author

Newbie - Best practice for a new .db ?

Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
Hello all,
what is the best pratice in order to have an app working with a sqllite db?
1-Create the db on the PC and put it in the apk ?
2-Using a webservice ?
3-Using a txt file and create the db the first time ?
4-..........
Sorry for the noob question... just starting here!
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Generally the app would create the DB programmatically. See http://developer.android.com/guide/topics/data/data-storage.html#db for links to two example apps that show how to do that.
Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
Tim Moores wrote:Generally the app would create the DB programmatically. See http://developer.android.com/guide/topics/data/data-storage.html#db for links to two example apps that show how to do that.


Tim, thanks for the answer, but it's still not clear!

I understand the use of onCreate() and onUpdate(), but I have to insert in the DB about 500 lines.

I can have and xml and read it in the onCreate(), ok; but, also, I can use a webservice and read it once in the same method.
Both of these are working, but which is the "best practice" ? (if there is one!)

Jagadeeswara Yaramala
Ranch Hand

Joined: Jul 28, 2010
Posts: 46
I thought this is of some help...!!
Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
Jagadeeswara Yaramala wrote:I thought this is of some help...!!


Thanks,mate!!!
It's a lot more than I asked!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Newbie - Best practice for a new .db ?
 
Similar Threads
database access
[Grails] Schema Export
wsad and oracle -SOS
How to bind a JNDI entry declaratively
What's the best "Local RDBMS" ?