Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Newbie - Best practice for a new .db ?

 
Alessandro Camel
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2789
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought this is of some help...!!
 
Alessandro Camel
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jagadeeswara Yaramala wrote:I thought this is of some help...!!


Thanks,mate!!!
It's a lot more than I asked!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic