Code example for CompoundButton

Methods: setOnCheckedChangeListener

0
   * @param button 
   *          the button being bound. 
   */ 
  public CompoundButtonCheckedProperty(CompoundButton button) {
    final WeakReference<CompoundButton> weakButton = new WeakReference<CompoundButton>(button);
    button.setOnCheckedChangeListener(new OnCheckedChangeListener() {
      @Override 
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        CompoundButtonCheckedProperty.this.trackable.updateTrackers();
      } 
    }); 
    this.getter = new Function<Boolean>() {
      @Override 
      public Boolean evaluate() {
        CompoundButton button = weakButton.get();
        if (button != null) {
          CompoundButtonCheckedProperty.this.trackable.track();
          return CompoundButtonCheckedProperty.this.lastValue = button.isChecked();
        } else { 
          return CompoundButtonCheckedProperty.this.lastValue;
        }