I have one Custom dialog box, which contanis one Recylerview + SearchView of CarBodyColorsNames. And one more thing I have adapter that have a custom row for each item. custom row consist of one Imagview(icons), TextView(colorName) and Checkbox for Selection.Its working fine but the problem is that, I want to store all the values that user has checked in String array according to its adapter position. following is my code:
edBodyColorAdapter.java
holder.checkBoxColor.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if(isChecked)
{
int position = holder.getAdapterPosition();
clickedColorNamePosition = edBodyColorArrayList.indexOf(filteredArrayList.get(position));
Toast.makeText(context, "current position = " + clickedColorNamePosition, Toast.LENGTH_SHORT).show();
String name = edBodyColorArrayList.get(clickedColorNamePosition).getBodyColorName();
Toast.makeText(context, "name = " + name, Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(context, "Unchecked", Toast.LENGTH_SHORT).show();
}
}
});
Simple I want when user click on Ok button i want to pick all the selected checkbox values.