any suggestion?

On 19 Mar, 13:17, sazilla <[EMAIL PROTECTED]> wrote:
> No I've not registered a TextView as a callback directly. Callbacks
> are applied to a TextView using a message Handler, the same as the
> remote service example of the SDK.
> The service engine starts on the onStart() function and make some
> callbacks, but these callbacks are displayed only when the engine
> finished. A remote service runs into a separate process, so I hope
> another thread is not needed.
> The Activity which starts the service is not blocked while the service
> is running, why the callbacks are not applied immediately when they
> are called?
>
> thanks
>
> On 17 Mar, 08:41, Josh Guilfoyle <[EMAIL PROTECTED]> wrote:
>
> > You register a TextView to the service?  What?  Services cannot
> > interact with the UI, as it is not thread-safe, nor is it functional
> > over separate processes.  You must add a layer of indirection and have
> > your UI managed exclusively by the UI thread, which is the implicit
> > one that your Activity runs along.
>
> > Anyway, check the RemoteService example carefully.  The significant
> > variable here is not whether the service is local or remote, but that
> > the RemoteService example in the ApiDemos package is simply a more
> > robust example of a service.
>
> > On Mar 13, 5:09 pm,sazilla<[EMAIL PROTECTED]> wrote:
>
> > > Hi and thanks a lot for your recommendations... yes I've been able to
> > > start the service and bind to it but I cannot manage correctly
> > > callbacks.
> > > I have to manage callbacks only when I bind to the service. In the
> > > ServiceConnection object I get the service back as a IBinder and then
> > > I register a TextView to the service as a callback. The service makes
> > > some callbacks but these are executed only when the service stopped.
> > > Where it could be the problem, should I use a remote service?
>
> > > thanks again
>
> > > Carlo
>
> > > On 13 Mar, 21:23, Josh Guilfoyle <[EMAIL PROTECTED]> wrote:
>
> > > > For your case, I would recommend using bindService with
> > > > BIND_AUTO_CREATE.  This way, theservicewill be launched if it's not
> > > > already, and you will be able to interact with it.  See the
> > > > RemoteService example in Android ApiDemos for ideal usage.  Be certain
> > > > to stop yourservicewhen it is done doing work.  Normally, this is
> > > > done by calling stopSelf() in theservice, but you can also call
> > > > stopService from the activity to kill it.
>
> > > > P.S. The difference between a remoteserviceand a local one is only
> > > > which process holds theservice, and thus whether IPC is necessary to
> > > > communicate with it.  A localserviceis merely an optimization for
> > > > your application, and the distinction is specified exclusively through
> > > > AndroidManifest.xml.
>
> > > > On Mar 12, 12:30 pm,sazilla<[EMAIL PROTECTED]> wrote:
>
> > > > > ah ok, I just want to make theserviceable to communicate with the
> > > > > Activity/IntentReceiver whch has started it. So as you say I canstart
> > > > > theservicewith StartService and thenbindwith it using BindService.
> > > > > that is right?
> > > > > thanks
>
> > > > > Charlie Collins ha scritto:
>
> > > > > > You will probably need to clarify that a bit.  What callbacks do you
> > > > > > mean?  If you mean the ServiceConnection ones (onServiceConnected 
> > > > > > and
> > > > > > onServiceDisconnected) then no, I don't think you can do that unless
> > > > > > youBINDto theservicerather than starting it.
>
> > > > > > Keep in mind though, you can bothbindandstartaserviceif you need
> > > > > > to.  (That is, if you need theservicein the background all the time
> > > > > > for something, you canstartit when the platform starts - and then if
> > > > > > the sameserviceprovides access to a Binder that you need in an
> > > > > > Activity, you canbindto it also.)
>
> > > > > > On Mar 12, 2:31�pm,sazilla<[EMAIL PROTECTED]> wrote:
> > > > > > > Hi, can I manage callbacks from aserviceid I started it with
> > > > > > > startService()? How I can do that?
>
> > > > > > > thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to