So, it is "waiting" in a sense because of the sleep, but maybe you
    mean something else by "waiting"?


I don't, that's the idea. But you'd only get interrupted while in the
sleep(). You'd want something like

while (!isCanceled()):
{
doSomething();

if (!isCanceled())
  sleep(1000);
}

That's basically what I'm doing.  I take it that the boolean argument
to cancel() just gets me a quicker exit rather than waiting for the
sleep to continue?

Although, that seems like a strange use of AsyncTask.

I have a ListView that displays a list of people.  While
that Activity is visible, it is possible for another
thread to query a server and get another person.  The AsyncTask
in question queries the database once a second to see whether
there are any new records.  If there are, the ListView updates
accordingly.  Is that strange?

Also, what of my choice to check the database once a second?
To often?  Can I go to 1/10 of a second without impacting
CPU or battery usage?

Thanks,

Toby

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