Thanks Mark, I actually copied the RestaurantSQLiteHelper() and modified it to my needs... But this just didn't make a difference... maybe I'm not understanding the whole concept here of Updates()
Say I do the following: 1. Start app for the first time [create db v1] 2. Change version to 2 inside the code and re-run the app 3. OnUpdate() should be called with old=1 and new=2 [should happen only once ever] Why would onUpdate be called? What makes this get triggered? Sorry for not understanding here what's happening... :( -Moto On Nov 9, 9:15 pm, Mark Murphy <[email protected]> wrote: > Moto wrote: > > Ok, > > So the samples are a great guide and has helped me to better update a > > new table, but still having same issue the oldVersion is always the > > old version it never gets updated!!! > > > Why is this happening? The OnUpdate function gets called once in a > > while and my database tries to update when it shouldn't and messes up > > my data... :( I can check for column count and know that I don't need > > to update but this is not a great solution... it's going to hunt me on > > the future... > > > Please help!? Where or how do we tell the SQLiteOpenHelper class that > > we are a new version now..? It seems that is not getting updated... : > > ( > > When somebody hands you a sample, the first thing you do is make sure > the sample does what they say it does. So, in the case of what I > provided you, you have ready access to "before" and "after" code, where > the schema version number changes. Test that code WITHOUT MODIFICATION > and confirm that it works as expected. If it does not, then perhaps it > is a faulty AVD or something. > > Assuming the sample code does indeed work properly, you need to figure > out what that sample code is doing that your code is not (or vice > versa). Usually, I start with the sample code, slowly modifying it step > by step to look like what I need it to. Eventually, I either find where > I went wrong originally (in which case I can zip to the end), or I > eventually get the sample changed to the point where it does what I need > and still works. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > App Widgets Deep Dive Seminar, 27 January 2010:http://bit.ly/deepdive -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

