No, that link is to the public open-source repository. On Tue, Jan 25, 2011 at 10:33 PM, Brill Pappin <br...@pappin.ca> wrote:
> I should mention this is on a Nexus One with aOS 2.2.2 in case that > matters. > > Yes, I looked all over that code and even down into AsbListView. > It actually registers an internal instance member with the adapter, > and the notify call does seem to make it to the observer as far as I > can see, but there doesn't seem to be any code that connected the > observer and the ListView. > > I was digging down that far in the first place because I was sure > (three times over, I rewrote it from scratch three times using > different examples and tutorials besides my first attempt from memory) > that I had correctly implemented the Adapter and set it on the > ListView. The list view simply never called the adapter after the > notify method was called. I know that because I used the basic print- > to-log when called technique of tracing the calls. The Adapter would > get properly called when first set on the ListView but after that no > amount of data change and notify calls would cause it to re-read the > adapter, which is what I expect it to do if I notify it that my data > has changed. > > I the end I simply created a new adapter and reset it on the ListView, > which seems to be working, however that's broken IMO. > > I think the next step should be that I write up a quick demo app that > attempts replicate the problem. If it doesn't do anything except > demonstrate what I'm seeing, then it should allow others to test as > well. > I'll see if I can make time tomorrow for that. > > BTW - That link seems to not be visible to me :) must be on your > internal network. > > - Brill Pappin > > On Jan 26, 12:35 am, Dianne Hackborn <hack...@android.com> wrote: > > AsbListView and ListView call registerDataSetObserver() on the adapter. > > BaseAdapter.notifyDataSetChanged() does the notification to whoever is > > registered with it. > > > > Here is working code, the Running Services UI in settings, that > implements a > > BaseAdapter and uses notifyDataSetChanged() to tell the list view when > its > > contents change: > > > > http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;... > > > > > > > > > > > > > > > > > > > > On Tue, Jan 25, 2011 at 8:37 PM, Brill Pappin <br...@pappin.ca> wrote: > > > I just searched the forums, and apparently this is a common problem. > > > > > ListView with a custom adapter based on BaseAdapter. > > > Its backed by a List object. > > > > > The problem is that updating the data and calling > notifyDataSetChanged(); > > > does nothing. > > > I have modified the adapter so that ever method that is called in it > prints > > > itself to the console. > > > > > my adapter has a method that does the update of the contents and > attempts > > > to notify: > > > > > public void updateData(List<Event> data) { > > > > > this.data.clear(); > > > > > this.data.addAll(data); > > > > > notifyDataSetChanged(); > > > > > } > > > > > The problem is that after notifyDataSetChanged() is called, the list > never > > > calls any other methods, not even getCount(). > > > > > My data has changed, and i've notified ListView that it has, yet it > still > > > refuses to update. > > > > > After some investigation in the OS source, I don't see where the > observer > > > in the list actually tells the list to update. > > > > > It seems the only way to get the list to update its elements is to > re-set > > > the adapter on it with the new element set. > > > > > Now I've seen many threads in the group saying that they user was doing > > > something wrong... but I don't see how the notify is going to update > the > > > list period (change or no change). > > > > > So, I think i'm dealing with a bug here. > > > > > Can someone actually find the code that does the update in the ListVIew > > > when adapters notifyDataSetChanged() is called? > > > > > - Brill Pappin > > > > > -- > > > 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<android-developers%2bunsubscr...@googlegroups.com><android-developers%2Bunsubs > cr...@googlegroups.com> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com > > > > 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 android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com 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 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