title: Reading all the events happened during 3 days from the calendar into my android app
body: <p>I'm trying to log all the events which are happening for 3 days from today in my activity. I'm getting the following errors. Please help.
  My Code : </p>
  
  <pre><code> public static long getStartOfDayInMillis() {
          Calendar calendar = Calendar.getInstance();
          calendar.set(Calendar.HOUR_OF_DAY, 0);
          calendar.set(Calendar.MINUTE, 0);
          calendar.set(Calendar.SECOND, 0);
          calendar.set(Calendar.MILLISECOND, 0);
          return calendar.getTimeInMillis();
      }
  
  
      public static ArrayList&lt;String&gt; readCalendarEvent(Context context) {
          Uri.Builder eventsUriBuilder;
          eventsUriBuilder = Uri.parse("content://com.android.calendar/events").buildUpon();
          ContentUris.appendId(eventsUriBuilder,getStartOfDayInMillis());
          ContentUris.appendId(eventsUriBuilder, getStartOfDayInMillis() + 3*(24 * 60 * 60 * 1000));
          Uri eventsUri = eventsUriBuilder.build();
          Cursor cursor = context.getContentResolver()
                  .query(
                          eventsUri,
                          new String[] { "calendar_id", "title", "description",
                                  "dtstart", "dtend", "eventLocation" }, null,
                          null, CalendarContract.Instances.DTSTART + " ASC");
          // fetching calendars name
          String CNames[] = new String[cursor.getCount()];
  
          // fetching calendars id
          nameOfEvent.clear();
          startDates.clear();
          endDates.clear();
          descriptions.clear();
          for (int i = 0; i &lt; CNames.length; i++) {
  
              nameOfEvent.add(cursor.getString(1));
              startDates.add(getDate(Long.parseLong(cursor.getString(3))));
      //        endDates.add(getDate(Long.parseLong(cursor.getString(4))));
              descriptions.add(cursor.getString(2));
              CNames[i] = cursor.getString(1);
              cursor.moveToNext();
  
          }
          return nameOfEvent;
      }
  </code></pre>
  
  <p>I'm calling it to give logs of all the names of the events in the same Java class as.. </p>
  
  <pre><code>results=   readCalendarEvent(MyCalendarActivity.this);
      for(int i=0;i&lt; results.size();i++ )
          Log.d("results",results.get(i));
  </code></pre>
  
  <p>I'm getting the following errors : </p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Unknown URL content://com.android.calendar/events/1448821800000/1448908200000
  </code></pre>