Saturday, June 25, 2011

Re: [android-developers] Re: Update activity UI from service using observer pattern

2011/6/25 Kostya Vasilyev <kmansoft@gmail.com>:
> It seems to me that the code you previously posted is a bit too naive.

That's true. I'm currently just probing the platform.

> The adapter's getView method can get called multiple times, not neecessarily
> in a partcular order, etc. It's Ok to trigger program logic based on
> getView, but you've got to carefully check your program's current state.

Posted snippet lacks some details.

The state of workers is managed by service. Adapter gets the
information from the service, too.
Re-registration of listeners is handled correctly as soon as they are
stored in map indexed by Download object (which correctly understands
equality/non-equality (equals(), hashCode()).
This is probably not the most efficient approach, however, for the
first time I decided to avoid "premature optimization" :).


> There is a good article on the official android-developers blog that ties
> together ListView and network operations that run on background threads (and
> more). The title has something to do with multithreading (or multitasking).
> Sorry I can't be more specific, this is from memory.
> -- Kostya
>
>

--
Best regards,
 Vadim

God, grant me the serenity to accept the things I cannot change,
courage to change the things I can,
and wisdom always to tell the difference.
Rainhold Niebuhr

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

No comments:

Post a Comment