Code example for DataOutputStream

Methods: flush, writeByte

0
			public void onCheckedChanged(CompoundButton buttonView,
					boolean isChecked) {
				if (dos != null) {
					if (isChecked) {
						try { 
							dos.writeByte(1);
							dos.flush();
						} catch (IOException e) {
							Log.e(TAG, "IOException: ", e);
						} 
					} else { 
						try { 
							dos.writeByte(0);
							dos.flush();
						} catch (IOException e) {
							Log.e(TAG, "IOException: ", e);
						} 
					} 
				} 
			} 
		});