that solved it, tx! i just waited to close the database until after
closing the cursor, and no more error. (i had thought that the cursor
had a life independent from the database, so very interesting fact!)

On Mar 5, 6:44 pm, Mark Murphy <[email protected]> wrote:
> I am skeptical that your error is being caused by this code. Check out:
>
> http://stackoverflow.com/questions/4195089/what-does-invalid-statemen...
>
> On Sat, Mar 5, 2011 at 7:21 PM, Marshall Farrier
>
>
>
>
>
> <[email protected]> wrote:
> > The following code is supposed to test whether the SelfCursor is empty or
> > not and to do different things depending on that result:
>
> > private void register() {
>
> >       registered = false;
>
> >         db = new ChessDataBaseAdapter(this);
>
> >         db.open();
>
> >         Cursor c = db.getSelfCursor();
>
> >         Log.d(TAG, "closing database");
>
> >         db.close();
>
> >         if (c.moveToFirst()) {
>
> >             // TODO
>
> >             c.close();
>
> >         }
>
> >         else {    // Player has not yet registered
>
> >             Log.d(TAG, "closing self cursor");
>
> >             c.close();
>
> >             startRegistrationActivity();
>
> >         }
>
> >     }
>
> > moveToFirst() is supposed to return false if the cursor is empty, and that’s
> > what I’m wanting here. But, when my cursor is empty, it’s also causing a
> > bothersome error to show up in LogCat:
>
> > Cursor      invalid statement in fillWindow()
>
> > The program doesn’t crash, but I still don’t like seeing the error. I gather
> > that fillWindow() (in AbstractCursor) is supposed to copy data from the
> > cursor to the CursorWindow, which is no doubt a problem if there’s nothing
> > in the cursor.
>
> > Is there a good way to test whether my cursor is empty without getting this
> > error—i.e., without calling fillWindow()? I first tried c.getCount() > 0 but
> > got the same error. Any other ideas?
>
> > --
> > 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
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 3.1 Available!

-- 
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

Reply via email to