Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Switch switchHora,switchFecha,switchYear,switchNotificaciones;
- //Declarar los botones
- switchHora = (Switch)findViewById(R.id.switchHora);
- switchFecha = (Switch)findViewById(R.id.switchFecha);
- switchYear = (Switch)findViewById(R.id.switchYear);
- switchNotificaciones = (Switch)findViewById(R.id.switchNotificaciones);
- //Switch Hora
- switchHora.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if(isChecked)
- {
- Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
- }
- else{
- Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
- }
- ////
- //Switch Fecha
- switchFecha.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if(isChecked)
- {
- Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
- }
- else{
- Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
- }
- ///
- //Switch Años
- switchYear.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if(isChecked)
- {
- Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
- }
- else{
- Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
- }
- ////
- //Switch Enviar Notificaciones
- switchNotificaciones.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if(isChecked)
- {
- Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
- }
- else{
- Toast.makeText(getApplicationContext(), "Boton Presionado", Toast.LENGTH_LONG).show();
- }
Add Comment
Please, Sign In to add comment