I agree with your comments, and have made attempts to do so. I use a message handler to update the items. Actually, I never even modify the List that the adapter has. I modify values in a Map that is initiated with the List items as the Map's values. Then, knowing the key, I update the Map item's icon through the handler. My code is based on something similar to the Manage Applications page of the Settings Application.
On Jun 26, 5:39 pm, Dianne Hackborn <[email protected]> wrote: > The first thing I would suggest is to not touch anything related to the view > hierarchy from another thread. It is really hard to know what all your > thread is doing and what problems it might be having, so I would first want > to see that potential issue eliminated from the equation. Instead, have it > sends whatever messages (or post runnables) to the main thread to modify the > view hierarchy / adapter state. > > There is also an ApiDemo of updating the contents of an adapter in a list > view as data is available; you can look at that to see if you are doing it a > similar way. > > > > > > On Fri, Jun 26, 2009 at 2:17 PM, Peter <[email protected]> wrote: > > > See my comments inline that should give you a better description and > > slightly more information. Thank you. > > > On Jun 26, 4:43 pm, Mark Murphy <[email protected]> wrote: > > > Peter wrote: > > > > I've tried to describe this problem a few times, but I'll try again. > > > > I saw your earlier posts. I could not make heads or tails of them then, > > > and I'm not having much better luck here. > > > Sorry. I'm making the mistake of hoping people identify the problem > > based on not very much information, partially because I'm lazy, I > > guess. > > > > > However, when 0 is updated, 5 mirrors its data on the screen > > > > briefly > > > > What, exactly, is "its" in the phrase "5 mirrors its data"? > > > Row 0 in the ListView contains an ImageView. Initially, all rows have > > a placeholder image. The thread updates row 0's ImageView, and I see > > the image updated on the screen. A split-second later, row 5's image > > is the same as row 0. So now, 0 has the new image, 1-4 still have the > > placeholder, and 5 shows the image associated with row 0. Then row 1's > > image is updated, and row 4 shows the same image. Then row 2 is > > updated with its image, (*screenshot linked below occurs here*) but 3 > > is next to load so it doesn't mirror row 2. So row 3 loads correctly, > > then row 4 reloads with the right image, then row 5 reloads. > > > Here is a link to a screenshot (with some client-specific info > > cropped) that shows the ListView and the images in question at the > > state described: > >http://picasaweb.google.com/lh/photo/QMVbTulUnXWwwXdhCBPEUw?feat=dire... > > > > Basically, I cannot parse your sentence, and so I have no idea what > > > behavior you are seeing. > > > > > How many views are created by default for an adapter? > > > > From the standpoint of the adapter, 0, since adapters do not create rows > > > unless asked. > > > > From the standpoint of the ListView (and you never indicated in your > > > email exactly what selection widget you're using; I'm just guessing), it > > > will create as many rows as is needed. That would be the lesser of the > > > number of rows in the data (as reported by the adapter) and the number > > > of rows that could be visible (as determined by the selection widget > > > type and, in the case of ListView, its size). > > > > > My guess is 3 based on what I see. > > > > If you are trying to say that you have a ListView that shows six rows, > > > then the answer should be six. You can verify this by using > > > hierarchyviewer to inspect your layout: > > > >http://developer.android.com/guide/developing/tools/hierarchy-viewer.... > > > I will try out this tool. > > > > -- > > > Mark Murphy (a Commons Guy)http://commonsware.com| > >http://twitter.com/commonsguy > > > > _Android Programming Tutorials_ Version 1.0 Available! > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. 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 [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 -~----------~----~----~----~------~----~------~--~---

