My application has a ListView that uses an EfficientAdapter (i.e.,
APIDemos/Views/Lists/List 14) to display a list of custom views (a
TextView with some line drawing on the left of each row and a checkbox
on the right of each row).

In the ListView's onItemClick listener, the checkbox changes state
(checked or unchecked) if the whole ListView is invalidated with
mListView.invalidateViews().  However when I try invalidating just the
changed row by calling v.invalidate() or mListView.invalidate(l,t,r,b)
in the following code, the EfficientAdapter's getView() for the
changed row doesn't get called.

    public void onItemClick(AdapterView<?> av, View v, int position,
long id) {
        mApp.listData[mListIndex].toggleCheck(position+1);
//      mListView.invalidateViews();  // this correctly updates the
checkbox state
//      v.invalidate(); // this doesn't
        mListView.invalidate(v.getLeft(), v.getTop(), v.getRight(),
v.getBottom()); // nor does this
        Log.d("onItemClick", "invalidate l,t,r,b: " + v.getLeft() +
                        ", " + v.getTop() +
                        ", " + v.getRight() +
                        ", " + v.getBottom());
        }

What should onItemClick() call to invalidate just the checked/
unchecked row?

In a possibly related question, why does APIDemos/Views/Lists/List 11.
Multiple Choice List redraw all rows (seen by enabling Dev Tools/
Development Settings/Show Screen Updates) whenever any checkbox is
tapped?

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