John Gaby wrote:
> Thanks much for your help.  The hiearchyviewer is a NICE tool of which
> I was unaware.  Unfortunately it simply shows that my ListView has no
> children (rows).  I believe I have discovered the problem, however,
> and am able to reproduce it with a pure Java application.  It seems
> that if I call the 'setAdapter' method AFTER I have place the ListView
> into it's parent, then it doesn't work.  I actually had not initially
> done that, but I needed a way for the ListView to refresh after I
> changed it's contents.  It SEEMED that if I reset the adapter that it
> would then ask me for the data again (it does ask for the count), but
> clearly this does not work.  So the real question is how do I tell the
> ListView to reload the data after I have changed the data that
> underlies the ListAdapter.

If your ListAdapter extends ArrayAdapter, you could use add(), insert(),
and remove() on the adapter itself to affect your changes, in which case
it will automatically call notifyDataSetChanged().

If your ListAdapter extends CursorAdapter, call requery() on the Cursor,
and that will automatically ripple out to the ListView.

At worst, call notifyDataSetChanged() on the ListAdapter.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org

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