to dear Dianne,

I don't think using remote callback is a good idea and mechanism. :-(

The callback of ServiceConnection can only be triggered "when the
service is already started" but not "when the service is not yet
started", and there will be a confusion during waiting for the
callback is triggered. Since the controller activity itself can not
know exactly when will the callback event happen (if the service is
started), the display of menu buttons will remain undecidable state.

If we always assume the service is not started first (that means the
"Start Service" button will always enable at first), and there will be
a weird behavior if we receive a message that the service is actually
started later in the callback event. In the other hand, if we assume
our service is already started first (that means the "Start Service"
should be disabled and "Bind Service", "Stop Service" buttons should
be enabled), and there will never have ways to decide whether the
service is "not started yet" or just "not yet to send a callback
event".

The better solution is modify the bindService's return value to
represent the state of a service, and this immediate and decidable
response is just what we need.

Best regards,
Nicholas

On 1月7日, 上午11時50分, "Dianne Hackborn" <hack...@android.com> wrote:
> The LocalServiceBinding API demo should be a good example, you'll just want
> to bind without the BIND_AUTO_CREATE flag so the service doesn't get created
> as a result of your own binding.
>
> On Tue, Jan 6, 2009 at 7:32 PM, Moto <medicalsou...@gmail.com> wrote:
>
> > I'm also interested on your solution but could you explain a little
> > more? new Binder?
>
> > Thanks,
> > Moto!
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> 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 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