Code example for ToggleButton

Methods: isCheckedsetOnCheckedChangeListenersetChecked

0
	/** 
	 * 	setupListeners 
	 */ 
	private void setupListeners() { 
		nameET.setOnEditorActionListener(this);
		lockTB.setOnCheckedChangeListener(this);
		saveButton.setOnClickListener(this);
	} 
 
	/** 
	 * 	setupWidets 
	 */ 
	private void setupWidgets() { 
		pageTitle.setText("Door");
		nameET.setText(door.getName());
		lockTB.setChecked(door.isLocked());
		pageTime.setText(DateFormat.getDateInstance().format(new Date()));
		leftButton.setVisibility(View.GONE);
		rightButton.setVisibility(View.GONE);
		 
		staleName = door.getName();
		staleLocked = door.isLocked();
	} 
	 
	/** 
	 * 	changeSaveButtonState 
	 */ 
	public void changeSaveButtonState() { 
		saveButton.setEnabled(!
				(staleLocked == lockTB.isChecked() &&
				staleName.equals(nameET.getText().toString())));
	} 
	 
	/** 
	 * 	saveButtonClick 
Stop searching for code, let great code find you!  Add Codota to your java IDE