/** * set selectedData according to selected items in adapterData * * @return number of chosen items */ private String setSelectedData() { String chosenNum = ""; for (int i = 0; i < adapterData.size(); i++) { GoodsInformation singleData = adapterData.get(i); if (singleData.getSelected()) { String temp = i + " "; chosenNum += temp; selectedData.add(singleData); } } return chosenNum; }
/** bind onClickListener for checkBox set full-checked state */ public void onCheckboxClicked(View view) { if (checkBox.isChecked()) { ToastUtil.showToast(this, checkBox.isChecked() + ""); for (GoodsInformation singleData : adapterData) { singleData.setSelected(true); } adapter.setFullChecked(true); adapter.notifyDataSetChanged(); } else { ToastUtil.showToast(this, checkBox.isChecked() + ""); for (GoodsInformation singleData : adapterData) { singleData.setSelected(false); } adapter.setFullChecked(false); adapter.notifyDataSetChanged(); } }