Sorry for the late reply...

Dianne, I'm not sure what you mean by keep the state in the service.
Do you mean keep the data to be sent to the GUI on the service, then
have the Activity request it? At the moment, I am doing something like
this:

Activity is alive -> Server thread checks status of Activity and sends
data via Handler to GUI, GUI is updated immediately.
Activity.onDestory() called -> Activity tell service to start storing
the data, Server checks the status of the Activity (which has now been
killed) and sends the data to the Service instead which saves it.
Activity is restarted-> Tells the Service to send all the data that
that was saved to the GUI and stop storing data. Server thread starts
sending data directly to the GUI again.

On Dec 18, 12:30 am, "Dianne Hackborn" <[email protected]> wrote:
> You need to keep that state in the service, and have the Activity be a
> viewer of the state.
>
>
>
> On Wed, Dec 17, 2008 at 11:44 AM, Al <[email protected]> wrote:
>
> > Usually I wouldn't mind if the Activity is stopped and no more updates
> > can be sent, but in this case (IRC app), I always need to keep the
> > channel info up to date, even when the app isn't in focus, so
> > suspending the thread is not an option. Also, for events like private
> > messages and highlights, I need to know so I can show the info in the
> > Notification bar and then the user can bring the app into focus and
> > reply or whatever.
>
> > On Dec 17, 7:30 pm, Michael <[email protected]> wrote:
> > > I have an app that uses a background thread to fetch data, then posts
> > > messages/runnables to keep the UI up to date.  When the UI is not
> > > visible, this thread is suspended.
>
> > > Pretty much, onCreate/onResume/etc for the Activity starts the
> > > background process if it's not running.
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
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