Code example for CompoundButton

Methods: getTag

0
	} 
 
	private class StateChangeListener implements OnCheckedChangeListener {
 
		public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
			byte portByte = (Byte) buttonView.getTag();
			if (isChecked) {
				try { 
					mServer.send(new byte[] { portByte, PIN_ON });
				} catch (IOException e) {
					Log.e(TAG, "problem sending TCP message", e);
				} 
			} else { 
				try { 
					mServer.send(new byte[] { portByte, PIN_OFF });
				} catch (IOException e) {
					Log.e(TAG, "problem sending TCP message", e);
				} 
			} 
		} 
	}