so I have a ListView
with item that when I click on one of the itens it bring me to a edit page with 3 check boxes. I want to do that whenever I check one of the CheckBox
all the other check boxes will be unchecked and the 3 checkbox will have Listview.backgroundcolor
on a specific item that I chose. I want check box that will make the background green the other one will be yellow and the third will be red. and after i click on save button the color will be saved
final CheckBox greenceck = (CheckBox) findViewById(R.id.greencheck);
final CheckBox yellowceck = (CheckBox) findViewById(R.id.yellowcheck);
final CheckBox redceck = (CheckBox) findViewById(R.id.redcheck);
greenceck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
yellowceck.setChecked(false);
redceck.setChecked(false);
greenceck.setChecked(true);
Vans.listView.getItemAtPosition(Color.GREEN);
notify();
}
});
yellowceck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
redceck.setChecked(false);
greenceck.setChecked(false);
yellowceck.setChecked(true);
Vans.listView.getItemAtPosition(Color.YELLOW);
notify();
}
});
redceck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
yellowceck.setChecked(false);
greenceck.setChecked(false);
redceck.setChecked(true);
Vans.listView.getItemAtPosition(Color.RED);
notify();
}
});
}
}
Aucun commentaire:
Enregistrer un commentaire