It looks to me in the Adapter source that notifyDatasetChanged(),
invalidateViews(), and notifyDataSetInvalidated() all have the desired
effect.  Reminds me of Perl programming - there are always seven right
ways to do something :-)

On Nov 11, 9:10 pm, Kumar Bibek <[email protected]> wrote:
> Anyway, you should be using the notifyDatasetChanged whenever you want to
> update the items in the ListView when the backing adapter has changed, be
> it, the contents, number of items, or the arrangement.
>
>
>
> On Fri, Nov 12, 2010 at 2:46 AM, jotobjects <[email protected]> wrote:
> > Thanks - Actually it turns out that I neglected to compile the version
> > with the runOnUiThread() call.  It now works (since the event that
> > caused the invalidate comes from a different thread).
>
> > So basically the version I showed in the post above does work.
>
> > Now I have problems with the view items in the ListView apparently
> > "sometimes" losing focus after the repaint.
>
> > On Nov 11, 12:51 pm, Stephen Jungels <[email protected]> wrote:
> > > For a ListActivity, try onContentChanged().
>
> > > On Thu, Nov 11, 2010 at 3:33 PM, Kumar Bibek <[email protected]>
> > wrote:
> > > > Try notifyDatasetChanged(). This should be called whenever the backing
> > data
> > > > us changed
>
> > > > On 12-Nov-2010 2:01 AM, "jotobjects" <[email protected]> wrote:
>
> > > > I have an ListActivity with a BaseAdapter where the contents have
> > > > changed (example - the rows are reordered).  I have tried
> > > > invalidate(),  invalidateViews(), and notifyDataSetInvalidated(). So
> > > > far no luck...
>
> > > > The ListView does not repaint.  getView() in the Adapter is not
> > > > called.
>
> > > > There are some similar posts but I did not see an answer.  Have tried
> > > > with and without the runOnUiLoop() call.
>
> > > > Does anyone see what I should do differently?
>
> > > > public class MyListActivity extends ListActivity
> > > > {
> > > >    public void onCreate(Bundle icicle)
> > > >    {
> > > >        setListAdapter(new MyAdapter());
> > > >    }
>
> > > >    MyListener registryListener = new  MyListener registryListener ()
> > > >    {
> > > >       �...@override
> > > >        public void onChange(String eventName)
> > > >        {
> > > >           . . . . do some work . . .
> > > >           runOnUiThread(new Runnable () {
> > > >                public void run ()
> > > > { getListView().invalidateViews(); }
> > > >            });
> > > >        }
> > > >    };
>
> > > >    class MyAdapter extends BaseAdapter
> > > >    {
> > > >        public View getView(. . .)
> > > >        {
> > > >        }
> > > >    }
> > > > }
>
> > > > --
> > > > 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]<android-developers%[email protected]>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > --
> > > > 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]<android-developers%[email protected]>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > 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]<android-developers%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com

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

Reply via email to