[android-developers] Re: Keeping GUI Updated

2008-12-22 Thread Al
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

[android-developers] Re: Keeping GUI Updated

2008-12-17 Thread Michael
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.

[android-developers] Re: Keeping GUI Updated

2008-12-17 Thread Al
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

[android-developers] Re: Keeping GUI Updated

2008-12-17 Thread Michael
Ah yeah. You can't just reconnect with an IRC client like I can with my app. And your app might be killed outright, in which case you'd have to completely restart it... But you should be able to get away with a background thread running to keep the connection open, just don't update the UI if

[android-developers] Re: Keeping GUI Updated

2008-12-17 Thread Dianne Hackborn
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 alcapw...@googlemail.com 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