BaseExpandableListAdapter notifyDataSetChanged()不重新生成适配器

时间:2015-09-22 16:23:56

标签: android adapter notifydatasetchanged

我遇到的方法notifyDataSetChange()有问题,该方法是从ImageView的onClickListener方法中调用的。当我单击图像时,适配器必须重新生成从存储视图的List获取的视图。这是一些代码:

public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    final Product currentProduct = parentList.get(groupPosition).getProduct();
    convertView = parentList.get(groupPosition).getParentView();
if(type == TicketType.FRAGMENTED){
        productHeaderCheck.setVisibility(View.VISIBLE);
productHeaderCheck.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (parentList.get(groupPosition).isChecked()){
                    parentList.get(groupPosition).setChecked(false);
                    parentList.get(groupPosition).uncheckAllChildrenItems();
                    TicketFragment.updateTicketPrice(currentAmount,false);
                }else{
                    TicketFragment.updateTicketPrice(getCurrentAmount(parentList.get(groupPosition), currentAmount), true);
                    parentList.get(groupPosition).setChecked(true);
                    parentList.get(groupPosition).checkAllChildrenItems();
                }
                notifyDataSetChanged();
            }
        });
    }
    return convertView;
}

有人能帮帮我吗?提前谢谢!

0 个答案:

没有答案