I just looked at it.

1)  They state that it is only an optimization and that you are not to
rely on the method being called.

2)  My design is a little too complex to use that elegantly.  I do
network calls from multiple activities and some dialogs on those
activities, which need to chain to other actions upon completion.

I'm learning about Services right now and I think that if I could have
a network service that I can register a specific callback with, like a
"User Updated" callback, it would work really well.  When the service
finishes updating a user, it simply notifies the user updated
callback.  It won't care if it was the original activity/dialog or a
new one.

Does that sound feasible?

On May 27, 2:22 pm, Streets Of Boston <[email protected]> wrote:
> Take a look at the method onRetainNonConfigurationInstance() of the
> Activity class. :-)
>
> http://developer.android.com/reference/android/app/Activity.html#onRe...()
>
> On May 27, 2:01 pm, Robert Green <[email protected]> wrote:
>
> > I have an app that communicates with a server.  While it is
> > communicating, it shows a progress dialog.  The way this actually
> > works is that I have a class that I call my NetworkGateway.  Each
> > method takes a Handler as a callback so that the gateway can send back
> > the response as a bundle when it has finished.
>
> > Right now when someone changes orientation while a network operation
> > is occuring, the activity doesn't know that a thread is running the
> > network code and then the callback might be invalid.
>
> > What's the right way to do this?  I want to make it so that after the
> > orientation switch, the activity can check something to see if a
> > network operation is running and if so, display the progress dialog
> > again and wait for the callback, or set itself as the callback handler
> > now, invalidating the old one.
>
> > My first guess is that this is exactly the kind of thing services were
> > designed for, but I'd like specifics if anyone can supply them.
>
> > Thanks!
>
>
--~--~---------~--~----~------------~-------~--~----~
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