One way of doing this would be to convertView.setTag() to a well-known value when binding each child item.
Then, when a progress event occurs, use ListView.findViewWithTag() to find the target View, or fail silently if it doesn't exist. Each time a view is recycled, your bind step above would be updating the tag to match the content. j On Wed, Aug 12, 2009 at 2:34 AM, Neil<[email protected]> wrote: > > Hi, > > I've recently got into Android development and am writing a basic > podcast app as a learning exercise. I've come up with an issue I can't > find a good solution for. Rather than post code (it's getting big!), > I'll try and summarise: > > I have an ExpandableListView showing podcasts and each podcast's > episodes in a simple two-level tree. The podcasts are downloaded in a > Service, and this Service 'sends' messages by using an interface > registered by the main Activity. This interface then uses a handler to > update the UI. > > The child views in the ExpandableListView are LinearLayouts with one > TextView and two ViewStubs, one for showing an image and one for > showing a horizontal ProgressBar. These layouts are created if needed > in my extended BaseExpandableListAdapter's getChildView, or reused by > using the convertView supplied. > > This all works fine and I'm happy with the overall model, except that > I can't figure out how to update a download's ProgressBar efficiently > when the Activity receives a callback from the Service. How do I get a > reference to the correct View to set its progress? > > I've tried keeping a cached HashMap to track which episode currently > has which View instance, but this didn't work due to me recycling the > Views via convertView - I found that when more than one download is > active the two bars can swap values back and forth. > > Any help would be appreciated. > > Thanks, > > Neil > > > > -- Jeff Sharkey [email protected] --~--~---------~--~----~------------~-------~--~----~ 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] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

