I create checkboxes dynamically with a code like this:
int Array_Count=0;
String[] Str_Array;
Array_Count=Str_Array.length;
LinearLayout my_layout = (LinearLayout)findViewById(R.id.my_layout);
for (int i = 0; i < Array_Count; i++)
{
TableRow row =new TableRow(this);
row.setId(i);
row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
CheckBox checkBox = new CheckBox(this);
checkBox.setOnCheckedChangeListener(this);
checkBox.setId(i);
checkBox.setText(Str_Array[i]);
row.addView(checkBox);
my_layout.addView(row);
}
After its created the user can check or uncheck. With the check, I need to do run another command for every checkbox.
My problem is, how do I use the checkboxes? How i can "speak" with so i can work with it?
Aucun commentaire:
Enregistrer un commentaire