Using just those in a do-while loop gave me an error in databases
without rows:

What seems to work for me is:

cursor.moveToFirst();
for (int i=0; i<cursor.getCount(); i++)
{
    ...
    cursor.moveToNext();
}



On Aug 26, 2:54 pm, android_dev <[EMAIL PROTECTED]> wrote:
> Use
>
> cursor.moveToFirst()
>
> and
>
> cursor.moveToNext()
>
> On Aug 26, 2:33 pm, kingkung <[EMAIL PROTECTED]> wrote:
>
> > Obviously
>
> > if (cursor.first()) {
> >    do
> >    {
> >      ...
> >    } while (cursor.next())
>
> > }
>
> > doesn't work anymore.
>
> > What's the right way to iterate through the rows of a database table
> > without running into errors from empty databases, etc.?
>
>
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to