views:

460

answers:

1

What should I do to use custom checkboxes if I add my checkboxes dynamically in my code? (On the java code not on the XML files.) I'm following this tutorial, but using it I can't achieve my goal.

For example, I have a tableLayout and I want to add a checkbox for each new row I have.

Thank you all.

A: 

Hi

you can do it like this

TableLayout tl=new TableLayout(this);  
 TableRow tr=new TableRow(this);  
 CheckBox chk=new CheckBox(this);  
 CheckBox.setText("Hello");  
 tr.addView(chk);         
 tl.addView(tr);  
 setContentView(tl); 

hope it helps

Mina Samy
Yes, im doing this to add the checkboxes dinamically, but i cant add custom checkboxes, just the default ones.Thank you anyway.
fxi