The use case is that the user should always see the loading progressbar if there's any background work being done in whatever activity the user is and if the task was launched from another activity. I tried putting a reference in the application class to the progressbar and then refresh it in the activities in the oncreate and onrestart,that the way the task will always have the refreshed reference on the postexecute method.... Any inconvinients on this procedure?
regards, On Fri, Sep 23, 2011 at 7:13 PM, blake <blake.me...@gmail.com> wrote: > AsyncTasks are a nifty tool but they have a fairly limited specific > set of uses. The previous responses have pointed out a several > problems with this code: you can't keep static refs to Activites or > Views, multiple Activities can't share a progress bar, etc. > > I don't understand the use case, but I agree with Mark that, from the > code you've supplied, this might be better done as an IntentService or > as a pair of Fragments. > > I'm going to be giving a Webinar on the pitfalls surrounding > AsyncTasks next week, on the 29th: > > http://oreillynet.com/pub/e/2061 > > -blake > Programming Android, FTW! > http://oreilly.com/catalog/0636920010364 > > -- > 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+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en