Code which i hv used to create the checkboxes
try{
for (int i = 0; i < Utstyr.size(); i++) {
cb = new CheckBox(getApplicationContext());
cb.setText(""+Utstyr.get(i));
cb.setTextColor(Color.parseColor("#000000"));
cb.setTag(""+list_sted.get(i));
cb.setTextAppearance(getBaseContext(), android.R.attr.checkboxStyle);
checkbox_lay.addView(cb);
}}
catch(Exception e){
System.out.println("ohh i got busted...!!!");
}
How to get the value of which checkbox is being selected.. i want h name of the checkbox
CheckBox[] chkArray = new CheckBox[Utstyr.size()];//
for (int i = 0; i < Utstyr.size(); i++) {
chkArray[i] = new CheckBox(getApplicationContext());
chkArray[i].setText(""+Utstyr.get(i));
chkArray[i].setTextColor(Color.parseColor("#000000"));
chkArray[i].setTag(""+Utstyr.get(i));
chkArray[i].setTextAppearance(getBaseContext(), android.R.attr.checkboxStyle);
checkbox_lay.addView(chkArray[i]);
}
for (int k = 0; k < Utstyr.size(); k++){
if(chkArray[k].isChecked()){
//Do something
}
}
Hope this helps.. :)