Service and GUI

Put your problem here if it does not fit any of the other categories.

Service and GUI

Postby confused » Wed Dec 17, 2008 7:48 pm

Hi,

I have a service which maintains a connection to a server and sends info, via a Handler, to the GUI. The problem I'm having is when my Activity is killed, the text (obviously) can no longer be updated.

Does anyone know how I can keep my GUI updated with the info? I'm not sure how to change my app to do this, maybe I need to make the GUI in a separate class started by the Service?

Thanks.
confused
Junior Developer
Junior Developer
 
Posts: 16
Joined: Fri Oct 03, 2008 2:30 pm

Top

Postby MrSnowflake » Wed Dec 17, 2008 11:09 pm

When get the interface to the service, you should implementa way to register listeners, just like Views have OnClickListeners. Then you can easilly call these listener (if they are set) from the service and so nothing can go wrong when the Activity dies.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby confused » Thu Dec 18, 2008 1:11 am

MrSnowflake wrote:When get the interface to the service, you should implementa way to register listeners, just like Views have OnClickListeners. Then you can easilly call these listener (if they are set) from the service and so nothing can go wrong when the Activity dies.


I don't quite understand what you mean and don't think you got my question.

I have a GUI which is sent info from a Service which has a connection thread. Once the GUI is killed, due to lack of memory, etc, I need to still send info to my GUI. My service and connection thread are still alive, but my GUI activity is dead for now, so how can I keep it up to date? I'm not sure how listeners are relevant here :?:
confused
Junior Developer
Junior Developer
 
Posts: 16
Joined: Fri Oct 03, 2008 2:30 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 21 guests