0

我有一个使用自定义适配器填充的列表视图。列表视图包含 2 个列表和一个图像。.Format- list list image

单击该按钮时,我想同时从两个列表中删除项目。

我尝试使用onclickonitemclick但应用程序崩溃了。

如何同时删除两个列表?列表不保存在日期库中。项目存储在Vector.

索引和视图有什么用?当自定义适配器扩展时Base Adpater,我们得到一个包含参数位置的 getView 方法。这与索引值相同吗?

code-holder.imgBtn.setOnClickListener(new ImageView.OnClickListener() {

                @Override
                public void onClick(View arg0) {
                     Index index = (Integer)  arg0.getTag();
                    if(index>=0){                        

                    prescriptionRemoval = ProgressDialog.show(AddToCartActivity.this, null, getResources().getString(R.string.prescriptionRemoval));    
                    String removeDrug=drugNameList.get(index);
                    String removePrescription=prescriptionList.get(index);  
                    String removeTotal=removeDrug+removePrescription;
                    listCheck.remove(removeTotal);
                    drugNameList.remove(index.intValue());
                    prescriptionList.remove(index.intValue());
                    notifyDataSetChanged();
                    handler.sendEmptyMessage(DIALOG_PRESCRIPTION_REMOVAL);  
                     }
                }
            })
4

1 回答 1

0

找到答案。获取位置并删除具有位置值和 notifydatasetchanged() 的两个列表

于 2012-12-02T11:32:32.373 回答