As for the broadcast solution, can an Activity receive a broadcast
while it is rotating? Will all the broadcasts sent to it be received?

About the Messenger, is it possible to create a Messenger from a
Service to an Activity? In the Messenger tutorial, it says "it sends a
Message to the service that includes the client's Messenger in the
replyTo parameter of the send() method." It seems that the Service can
only "reply to" a message from the Activity. Can a Service initiate a
message and send to the Activity?

On 6月4日, 下午11時35分, Mark Murphy <mmur...@commonsware.com> wrote:
> On Mon, Jun 4, 2012 at 11:30 AM, Greenhand <cooperateonl...@gmail.com> wrote:
> > If I use startService(), can theActivitycommunicate with theService
> > and vice versa?
>
> startService() uses a variation of the command pattern: you
> "communicate" with theservicevia extras on the Intent passed to
> startService() as the command. Theservicecan then use a Messenger,
> or broadcasts, or local broadcasts, or a PendingIntent, etc. to
> trigger UI updates based upon work that was completed.
>
> You are welcome to use both binding and startService(), if you wish,
> in which case the latter is simply to give the user more direct
> control over the start/stop of theserviceitself, with the binding
> for othercommunication.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in DC:http://marakana.com/training/android/
>
>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to