Code example for CheckedTextView

Methods: getText, isChecked, setChecked, toString

0
			// Called every time a list item is clicked 
			public void onItemClick(AdapterView<?> parent, View view, int position,
					long id) {
				// Get the RelativeLayout and toggle its selection 
				CheckedTextView selection = (CheckedTextView) view;
				Log.d("DSN Debug", selection.toString());
				if(selection.isChecked()) {
					selectedCuisines.remove((String) selection.getText());
					selection.setChecked(false);
				}else{ 
					selectedCuisines.add((String) selection.getText());
					selection.setChecked(true);
				} 
			} 
		}); 
	} 
	 
	/** 
	 * This is called when the user pushes the "Cancel" button. The activity will 
	 * finish and the cuisine filter will remain in the same state it was when this 
	 * activity was started.