Hello to everyone.

I have an application with service doing background work by
instantiating AsyncTasks and activity displaying progress of that
work.

As soon as updates are expected to be quite often I preferred to make
connection between service and activity through listener rather than
via broadcast intents/receiver.
General lifecycle of application as intended by design I've tried is
the following:
Activity starts -> binds to service in onCreate -> registers listener
to the particular AsyncTask within service after bind succedes ->
receives updates -> unregisters listener in onPause -> unbinds in
onDestroy
This works fine (log shows it works as expected) but I've got a
problem with updating UI in activity.

I understand that activity UI updates must be performed on UI-thread.
And that I've checked first and it seem to be ok, as soon as code with
updates within listener runs on main thread just like activity's on*()
methods. To ensure this I've also tried to wrap code in listener with
posting runnable to runOnUiThread() of my activity. That also gives
nothing (UI updates happen in one instance of emulator and do not
happen in another and also on real device, however screen is updated
if I scroll contents down and back).

So the question is whether described scenario is possible on Android
or should I just use broadcast receiver as the only way to accomplish
my goal?

Thanks in advance.

-- 
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