Chia sẻ với các bạn cách update 1 row view trong ListView.
Cụ thể ở đây mình code cho ExpandableListView

Mã:
public View getChildView(final int groupPosition, final int childPosition,            boolean isLastChild, View convertView, ViewGroup parent) {this.viewGroup = parent; currentGroupPosition = groupPosition;currentChildPosition = childPosition;}         // update single row view.        ExpandableListView el = ((ExpandableListView) viewGroup);        int first = el.getFirstVisiblePosition();        int last = el.getLastVisiblePosition();        int cnt = last - first + 1;        for (int i = 0; i < cnt; i++) {            View v = el.getChildAt(i);            try {                TextView tv = (TextView) v.findViewById(R.id.name);                if (tv == null) {                    continue;                }                 AppInfo item = (AppInfo) getChild(currentGroupPosition,                        currentChildPosition);                if (item.getAppName().equals(tv.getText())) {                    if (v != null) {                        SeekBar sb = (SeekBar) v.findViewById(R.id.seekbar);                        if (sb != null) {                            sb.setProgress(transparentValue);                        }                        v.invalidate();                    }                     break;                }            } catch (Exception ex) {             }        }
Ở đây mình update 1 item dựa trên trường text hiển thị trên item đó, sau khi chuyển qua màn hình khác, thiết lập
giá trị và quay trở lại màn hình trước thì item đó sẽ được cập nhật.
Ở đây mình không sử dụng Notifidataset change bởi vì như thế sẽ update lại
nhiều phần tử hiển thị khác, cái mình quan tâm là chỉ 1 item đó thôi.
Hy vọng hữu ích cho các bạn.

View more random threads: