How to force a ListView to rebuild/repaint itself

by n179911 » Thu, 17 Sep 2009 08:13:11 GMT

Sponsored Links

Is there anyway to force ListView to rebuild/repaint itself?
i.e. re-get item from the ListAdapter (it can be a CursorAdapter or
ArrayAdapter) and then repaint the all the list view which are

Thank you.


How to force a ListView to rebuild/repaint itself

by Mark Murphy » Thu, 17 Sep 2009 08:18:45 GMT


For ArrayAdapter, modify the contents of the list through the adapter
itself (e.g., call add() on the ArrayAdapter), and it will automatically
update the UI.

For CursorAdapter, requery() the underlying Cursor, and it will
automatically update the UI.

Mark Murphy (a Commons Guy)  | 

_Android Programming Tutorials_ Version 1.0 In Print!


Sponsored Links

Other Threads

1. Changing package names fubars the map overlays?

This is odd.  I need to make my code pretty, so the first thing I want to do
is to change the all the strings 'com.appspot.lbtdl' to
'com.faberfedor.tagyourworld'. I change every string in all the directories
using the Perl 'pie' technique.  Then I put the code into a new directory,
create a new Eclipse project and run it.

For some reason, my code now crashes with a NullPointerException in my
MapView on the line

        map.getOverlays().add(new SitesOverlay(marker));

If I comment it out, the programs runs; wrongly, but it runs.  Both map and
marker have values/content/attributes/whatever you say a non-null object

I've diffed every file in the project and the *only* thing different is the
changing of my package name strings and the dir structure under src/.

Any ideas?


Faber Fedor
Cloud Computing New Jersey


2. how to use a content provider from other applications

Just went through a thread

3. Q: possible to add more of javax.xml.* API (interface) classes/packages in Android?

4. 8 MP Camera support?

5. OpenCode potential error while streaming

6. SurfaceHolder.lockCanvas(dirtyRectangle) bug?

7. ==== Replacing a codec lib in OpenCORE ====