Code example for ToggleButton

Methods: isChecked

0
        btnBoton2 = (ToggleButton)findViewById(R.id.BtnBoton2);
         
        btnBoton2.setOnClickListener(new View.OnClickListener() {
			public void onClick(View arg0)
			{ 
				if(btnBoton2.isChecked())
					lblMensaje.setText("Bot�n 2: ON");
				else 
					lblMensaje.setText("Bot�n 2: OFF");
			} 
		}); 
         
        btnBoton3 = (ImageButton)findViewById(R.id.BtnBoton3);
         
        btnBoton3.setOnClickListener(new View.OnClickListener() {
			public void onClick(View arg0)
			{ 
				lblMensaje.setText("Bot�n 3 pulsado!");
			} 
		}); 
Stop searching for code, let great code find you!  Add Codota to your java IDE