Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. TableLayout l = (TableLayout) findViewById(ID_OF_YOUR_LAYOUT);
  2. CheckBox box = new CheckBox(this);
  3. box.setChecked(true);
  4. box.setOnCheckedChangeListener(new OnCheckedChangeListener(){
  5.  
  6. public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
  7. //what happens when the it's unchecked or checked
  8. }
  9. });
  10.  
  11. l.addView(box);
  12.  
  13. RelativeLayout.LayoutParams layout =
  14. new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, 200);
  15. l.addView(box,layout);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement