I have a list view which contains 10 check boxes .I want that if user open app and check the first checkbox and i have a button "Next" if user pressed next then the next checkbox checked. I am using Adapter Class and View Holder class also.
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
CheckBox cb = (CheckBox) buttonView;
Planet planet = (Planet) cb.getTag();
planet.setChecked(cb.isChecked());
boolean isStart;
if (checkBox.isChecked()) {
if (selected != null) {
selected.setChecked(false);
}
checkBox.setChecked(true);
selected = checkBox;
});
} else {
Toast.makeText(getContext(), "hEY iTS eLSE", Toast.LENGTH_LONG).show();
}
notifyDataSetChanged();
}});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getContext(), "Next", Toast.LENGTH_LONG).show();
checkBox.setChecked(True)
}
}
});
Aucun commentaire:
Enregistrer un commentaire