0
多個複選框的值,我有其中之一爲一週的每一天:獲取Android上
mondayRadioButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mondayRadioButton.isChecked()){
deleteAppointmentsLayout.removeAllViews();
daySelected = 1;
for(Iterator<Appointment> i = appointments.iterator(); i.hasNext();){
Appointment item = i.next();
if(item.getDay() == 1){
checkBox = new CheckBox(DeleteAppointmentActivity.this);
System.out.println("fucken did work");
id = item.getId();
time = item.getTime();
duration = item.getDuration();
description = item.getDescription();
boxText = time + ", " + duration + ", " + description;
checkBox.setText(boxText);
checkBox.setTextSize(12);
checkBox.setId((int) id);
deleteAppointmentsLayout.addView(checkBox);
}
else {
System.out.println("fucken didnt work");
}
}
}
}
});
當一個按鈕一個onclick被激活,我要檢索的信息對每個選定複選框當前選擇的日期(複選框以編程方式生成)。當刪除按鈕的onclick被激活時,如何檢查選擇了哪些選項?
checkBox.isChecked() – Tom 2013-04-24 18:20:58
你試試我的答案? – codeMagic 2013-04-24 23:03:58