Code example for ToggleButton

Methods: getId

0
    private OnClickListener tbListener() {
    	return new OnClickListener() {
 
			@Override 
			public void onClick(View v) {
				if (v.getId() == onBtn.getId() && isOn == false  && isConnected == true) {
					isOn = true;
						        				 
	        		try { 
						out = new PrintWriter(kkSocket.getOutputStream(), true);
						out.println(ON);						
					} catch (IOException e) {
						e.printStackTrace();						
					} 
				} 
				else if (v.getId() == onBtn.getId() && isOn == true  && isConnected == true) {
					isOn = false;					
					try { 
						out = new PrintWriter(kkSocket.getOutputStream(), true);
						out.println(OFF);						
					} catch (IOException e) {