Code example for ToggleButton

Methods: getTag, isChecked

0
 
	@Override 
	public void onClick(View view) {
		if (view instanceof ToggleButton) {
			ToggleButton toggleButton = (ToggleButton) view;
			int position = (Integer) toggleButton.getTag();
			if (dataList != null && mOnItemClickListener != null
					&& position < dataList.size()) {
				mOnItemClickListener.onItemClick(toggleButton, position,
						dataList.get(position), toggleButton.isChecked());
			} 
		} 
	} 
 
	private OnItemClickListener mOnItemClickListener;
 
	public void setOnItemClickListener(OnItemClickListener l) {
		mOnItemClickListener = l;
	} 
 
	public interface OnItemClickListener {