Reading all of today's events using CalendarContract - Android 4.0+

前端 未结 5 959
日久生厌
日久生厌 2020-12-16 01:04

I\'m trying to use Android\'s new calendar API to read all of today\'s calendar events. I\'m have trouble finding the right selection on the database query to return all of

5条回答
  •  一整个雨季
    2020-12-16 01:34

    Your conditions only give you the events that are strictly in today limits. You should check the ones that start before today and end after (multidays event).

    For recurring events, I check them manually. I don't found another way.

    I use something like:

    String selection = "((" + CalendarContract.Events.DTSTART + " <= ?) AND (" + CalendarContract.Events.DTEND + " >= ?)) OR (" + CalendarContract.Events.RRULE + " is not null )";
    
    String[] selectionArgs = new String[] { dtEnd, dtStart};
    

    Regards,

提交回复
热议问题