Monday, July 4, 2011

Re: [android-developers] A service can update an activity?

On Fri, Jul 1, 2011 at 7:58 AM, Ricardo Longa <ricardo.longa@gmail.com> wrote:
> It is possible a "service" update an "activity" that is to active connection
> every 10 seconds (for example)?

Use a Messenger, or a broadcast Intent, or the PendingIntent you get
from createPendingResult() in the Activity. Or, if you are using
bindService(), simply pass over a listener object and have the service
call a method on the listener -- but be sure to unregister that
listener when the activity is destroyed, or you will leak memory.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1, http://bit.ly/smand2

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate