【发布时间】:2016-11-24 16:02:51
【问题描述】:
如何刷新 子列表 Expandable List View
我正在使用以下代码删除子列表item,但unable to refresh子项列表。
public class ListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<String> _listDataHeader;
private HashMap<String, List<String>> _listDataChild;
private DBAdapter mydb;
public SyncExpandablePendingListAdapter(Context context, List<String> listDataHeader,
HashMap<String, List<String>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(final int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
....
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.sync_pending_list_item, null);
}
....
btnDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("oldList:", _listDataChild.toString());
mydb.DeleteECRecord(data2);
_listDataChild.remove(childPosition);
notifyDataSetChanged();
Log.d("newList:", _listDataChild.toString());
});
}
.............
}
实际上,我没有得到我必须做出改变的地方?我到底错过了什么? :
请让我知道我在哪里做错了?我错过了什么?
【问题讨论】:
标签: android listview adapter expandablelistview baseadapter