Dave,

>From what I have seen, Romain's solution is a good way to go. To get
something working cheaply and quickly, however, you could just use a
static class that acted as a bridge between the two (not the bridge
pattern definition of bridge, just fyi). Have the activity contact the
bridge and register itself, and have the AsyncTask make calls on the
static object, which could either maintain state as needed (if you
need to stack up a bunch of calls for when the UI rotates) or simply
pass them through to the current activity.

I don't know the pro's and con's of this approach, I would really only
use it for bootstrapping and put something a bit more legit in there
one I had gotten it working.

Thanks,
Hamy

On Jun 2, 3:43 pm, Dave Bordoley <bordo...@gmail.com> wrote:
> So I have an AsyncTask that is being used to perform a simple http
> request in the background. As a constructor argument to the task, I
> pass a reference to the current activity and use methods on the
> activity to manipulate which gui elements are shown in the
> onPreExecute(), and onPostExecute() method calls. Now due to the fact
> that android tears down and rebuilds an activity when the screen is
> rotated, the UI is not properly updated based upon the AsyncTask as
> the refernce to the activity is no longer valid. Its not really clear
> to me how to handle this case. I'm also worried that this could lead
> to memory leaks. Any suggestions etc. would be appreciated.
>
> thanks,
>
> Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to