No more hair pulling! Found the problem!

At my Activities OnCreate() there was another class being called to
open the database and return a cursor and after it returned it it
would close the database I assume in the middle of my initial
onUpdate...

I'm not sure how to explain but calling only one time to open the
database is a good idea... :P

Mark thanks for your help!  I really was going to loose it!

-Moto

On Nov 9, 10:32 pm, Moto <medicalsou...@gmail.com> wrote:
> I truly puzzled by this...
>
> The source file helped but here is what's weird:
>
> When calling db.getWritableDatabase() this guy it the one that will
> check if it needs an update. I created the helper with version 1 and
> later tried to increase it to 2 and leave the OnUpdate() empty...
> acording to this snip from the getWritableDatabase() function it
> should update no problem:
>
>         int version = db.getVersion();
>         if (version != mNewVersion) {
>                 db.beginTransaction();
>                 try {
>                         if (version == 0) {
>                                 onCreate(db);
>                         } else {
>                                 onUpgrade(db, version, mNewVersion);
>                         }
>                         db.setVersion(mNewVersion);
>                         db.setTransactionSuccessful();
>                 } finally {
>                         db.endTransaction();
>                 }
>         }
>
> This code to me just confirms that there is something wrong...  The
> call getWritableDatabase() happens successfully and I don't get any
> exceptions or error hint code on the compiler...
>
> I'm about to pull my hair here... :(
>
> On Nov 9, 10:01 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > Moto wrote:
> > > Why would onUpdate be called? What makes this get triggered?
>
> > SQLiteOpenHelper calls onUpdate(). You can take a look at the source for
> > it -- it's only ~200 lines:
>
> >http://bit.ly/sqliteopenhelper
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > _Android Programming Tutorials_ Version 1.0 In Print!
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to