Code example for ToggleButton

Methods: isChecked, toggle

0
     
    timePicker.setOnTimeChangedListener(new OnTimeChangedListener() {
 
		@Override 
		public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
			if(real_time_button.isChecked()) {
				real_time_button.toggle();
			}	 
		} 	   
    }); 
  }  
 
  /** 
   * Handles closing of dialog. If user intended to save the settings, selected 
   * hour and minute are stored in the preferences with keys KEY.hour and 
   * KEY.minute, where KEY is the preference's KEY. 
   * 
   * @param okToSave 
   * True if user wanted to save settings, false otherwise 
   */ 
  @Override