Sunday, August 15, 2010

Re: [android-developers] AsyncTask, back button and cancel(boolean)

On Sun, Aug 15, 2010 at 6:32 PM, Filip Havlicek
<havlicek.filip@gmail.com> wrote:
> The AsyncTask takes let's say 30 seconds to complete, it's invoked in first
> tab and the results are displayed in second and third tab. If user dismisses
> the ProgressDialog, he can of course navigate to second or third tab. But if
> the tab is displayed when AsyncTask completes, the results aren't displayed
> unless there is some refresh of the tab activity (ie onResume or onCreate).

If you don't use activities as the contents of your tabs, but instead
use views, this becomes much simpler.

> Is there a way to "asynchronously" update the tab's content upon AsyncTask's
> completion?

If you don't use activities as the contents of your tabs, but instead
use views, you just update the views, no different than if you didn't
have tabs in the first place.

> (About the first question, I thought about preventing the ProgressDialog
> being dismissed by user pressing BACK button.)

Oh. AFAIK, the ProgressDialog itself handles its BACK button. Call
setCancelable() on the ProgressDialog to adjust its behavior.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate