一、CheckBox多选项的创建
mCheckBox1 = (CheckBox) findViewById(R.id.myCheckBox1);
/* 设定OnCheckedChangeListener给三个CheckBox对象 */
mCheckBox1.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener(){
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if(isChecked == true){
toast(buttonView.getText().toString());
}
else{
toast("未选中" + buttonView.getText().toString());
}
}
});
public void toast(String str) {
Toast.makeText(CheckBoxNew.this, str, Toast.LENGTH_LONG).show();
}