18 May

Android CheckBox Selection Control

CheckBox chk=(CheckBox)findViewById(R.id.Chk);
chk.setOnCheckedChangeListener(new OnCheckedChangeListener() {

  public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
      TextView txt=(TextView)findViewById(R.id.txt);
      if (arg1)
        txt.setText("checked");
      else
        txt.setText("Unchecked");    
      }         
   }
);

Leave a Reply

Your email address will not be published. Required fields are marked *