title: Method setOnDateChangeListener() of CalenderView not working properly
body: <p>I am working a calendar project in Android Studio. When I click on a date it opens a new Activity.The problem is that if a date is already selected ( like when you open a calendar you can see the current date already selected ), when I click on it, it gives me no response. How can I change this. This was not a problem from me when I was testing the application in the Android Virtual Device but when I installed the application in my phone this problem occurred.</p>
  
  <p>Check the photo that I have given, the date that I selected does not give response but when I was testing it on a AVD , if I clicked on a selected date it gave me response.</p>
  
  <p><a href="https://i.stack.imgur.com/2x7QA.png" rel="nofollow noreferrer">Calendar View Image</a></p>
  
  <pre><code>calendarView.setOnDateChangeListener(new 
   CalendarView.OnDateChangeListener() {
      @Override
      public void onSelectedDayChange(@NonNull CalendarView calendarView, 
   int i, int i1, int i2) {
          date = i2 + "" + i1 + "" + i;
          Date = Integer.parseInt(date);
          Log.e(TAG,"int date="+Date+"");
          Log.e(TAG,"string date="+date+"");
          //firstly check if an entry exists for the current date.
          Cursor res = myDb.getAllData();
  
          while(res.moveToNext()) {
              if (res.getInt(0) == Date) {    
  //only runs if it find the id for this date.
                  StringBuffer buffer = new StringBuffer();
  
                  buffer.append("Id :" + res.getString(0) + "\n");
                  buffer.append("Event Name :" + res.getString(1) + "\n");
                  buffer.append("Event Location :" + res.getString(2) + 
   "\n");
                  buffer.append("Event Discription :" + res.getString(3) + 
   "\n\n");
  
                  //when an id is present for event, than there must be an 
   entry for attendees, So search by date(id) for attendees.
                  Cursor cursor = myDb2.getAllData();
                  while(cursor.moveToNext()) {
                      String test=cursor.getInt(0)+"";
                      if (test.contains(date)) {
                          Log.e(TAG,"it reached here");
                          buffer.append("Event Attendee :" + 
  cursor.getString(1) + "\n\n");
                      }
                  }
                  // show message
                  showMessage("Data", buffer.toString());
                  return;
              }
          }
              //if no entry is found then pass the id as Date and shift to 
  activity_date_selected activity ).
              intent = new Intent(MainActivity.this, dateSelected.class);
                  intent.putExtra("date message", Date);
                  intent.putExtra("day message", i2);
                  intent.putExtra("month message", i1);
                  intent.putExtra("year message", i);
              startActivity(intent);
        }
     });
  }
  </code></pre>
  
  <p>Any kind of help will be appreciated. </p>