Code example for ToggleButton

Methods: isChecked, toggle

0
		localTaskToggleButton = (ToggleButton) findViewById(R.id.show_local_tasks_toggle);
		localTaskToggleButton.setOnClickListener(new View.OnClickListener() {
			 
			@Override 
			public void onClick(View v) {
				showLocalTasks(localTaskToggleButton.isChecked());
			} 
 
		}); 
	} 
	 
	private void showLocalTasks(boolean isLocalOnly) {
		if (latestLocation == null) {
			localTaskToggleButton.toggle();
			//TODO XXX popup no GPS is running 
			return; 
		} 
		if (isLocalOnly) {
			adapter.filterTasksByLocation(latestLocation, LOCATION_FILTER_DISTANCE);
		} else { 
			adapter.removeLocationFilter();