title: isChecked() returns true though the switch is not checked
body: <p>I have used a switch to set the notifications. I want to save the notifications if the switch is checked i.e. notification is on. </p>
  
  <p>But if I on the switch and again off the switch and save the event. Then also the notification is getting set. </p>
  
  <p>As I did debug on <code>if(isChecked() == true)</code> , it returns true if I on and off the switch once. If I do not change the state of switch it returns false.</p>
  
  <p>What's wrong? </p>
  
  <pre><code> notify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  
          @Override
          public void onCheckedChanged(CompoundButton buttonView,
                                       boolean isChecked) {
  
              if (isChecked) {
  
                  linearSelectTime.setEnabled(true);
                  linearSelectTime.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          final AlertDialog.Builder builder = new AlertDialog.Builder(AddEventActivity.this);
  
                          int selected = 0;
  
                          builder.setSingleChoiceItems(R.array.time_array, selected,
                                  new DialogInterface.OnClickListener() {
                                      public void onClick(DialogInterface dialog, int item) {
  
                                          String[] time = getBaseContext().getResources().getStringArray(R.array.time_array);
  
                                          notifyTime.setText(time[item]);
  
                                          notificationTime = time[item];
  
                                          dialog.dismiss();
                                      }
                                  });
                          builder.show();
                      }
  
                  });
              } else {
  
                  alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
                  intent = new Intent(getApplicationContext(), NotificationReceiver.class);
                  pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), RQS_1, intent, 0);
                  alarmManager.cancel(pendingIntent);
  
                  notificationTime = "";
                  notifyText.setVisibility(View.INVISIBLE);
                  linearSelectTime.setEnabled(false);
              }
  
          }
      });
  </code></pre>
  
  <p>on save:</p>
  
  <pre><code>                        if (notify.isChecked()) {
                              setNotificationTime(c);
  
                          }
  </code></pre>
  
  <p>What's going wrong here.?</p>