Guest User

Untitled

a guest
Apr 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. Switch switchHora,switchFecha,switchYear,switchNotificaciones;
  2.  
  3. //Declarar los botones
  4. switchHora = (Switch)findViewById(R.id.switchHora);
  5. switchFecha = (Switch)findViewById(R.id.switchFecha);
  6. switchYear = (Switch)findViewById(R.id.switchYear);
  7. switchNotificaciones = (Switch)findViewById(R.id.switchNotificaciones);
  8.  
  9. //Switch Hora
  10. switchHora.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  11. @Override
  12. public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  13. if(isChecked)
  14. {
  15. Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
  16.  
  17. }
  18.  
  19. else{
  20.  
  21. Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
  22. }
  23. ////
  24.  
  25. //Switch Fecha
  26. switchFecha.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  27. @Override
  28. public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  29. if(isChecked)
  30. {
  31. Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
  32.  
  33.  
  34. }
  35.  
  36. else{
  37.  
  38. Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
  39. }
  40.  
  41. ///
  42.  
  43. //Switch Años
  44. switchYear.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  45. @Override
  46. public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  47. if(isChecked)
  48. {
  49.  
  50. Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
  51. }
  52.  
  53. else{
  54.  
  55.  
  56. Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
  57. }
  58.  
  59. ////
  60.  
  61. //Switch Enviar Notificaciones
  62. switchNotificaciones.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  63. @Override
  64. public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  65. if(isChecked)
  66. {
  67.  
  68. Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
  69. }
  70.  
  71. else{
  72.  
  73. Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
  74. }
Add Comment
Please, Sign In to add comment