On 03/25/2011 08:28 AM, Kostya Vasilyev wrote:
Ah.
In this case, calling cancel with "true" does make sense, as it will
make sleep() abort immediately with an InteruptedException.
However, the loop still need to check AsyncTask.isCancelled().
So am I to understand then, that the only thing that will change
by calling cancel(true) is that I would not have to wait for the entire
remaining duration of the sleep for the task to end, whereas with
cancel(false), the sleep would complete before I could check
isCancelled() and exit?
Thanks,
Tobiah
More info on interrupting threads can be found here:
http://developer.android.com/reference/java/lang/Thread.html#interrupt()
-- Kostya
25.03.2011 18:08, Tobiah пишет:
The task looks like this:
while(true):
quickly_do_something()
sleep(1000)
So, it is "waiting" in a sense because of the sleep, but
maybe you mean something else by "waiting"?
Thanks,
Tobiah
--
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