I have 7 checkboxes and will be sorting a list on a button click, based on what criteria the user has checked on the checkboxes. Now I think that means that I will have 128 different combinations of checkboxes and that means 128 if statements which will take me all night!
Is there a better/faster way to do this? Maybe an alternative to checkboxes? The list would be sorted based on which combination of boxes have been selected by averaging the values associated with the checkboxes.
Example below:
if(ONE.isChecked())
{
//sort by 1
}
if(TWO.isChecked())
{
//sort by 2
}
if(THREE.isChecked())
{
//sort by 3
}
if(ONE.isChecked() && TWO.isChecked())
{
//sort by (1 + 2)/2
}
Aucun commentaire:
Enregistrer un commentaire