3

I'm attempting to gather up all currently occurring calendar instances. That is instances, not events nor calendars. I understand how content uris work but they are for querying instances which fall in some time range. I am looking for a way to get instances which begin before now and end after now. Perhaps there is a way to access the table directly like any old sql table?

Extra points if it an be done with a cursor appropriate for populating a ListView with the results.

adamwong246
  • 795
  • 9
  • 15

2 Answers2

0

There is good documentation about Calendars.

David Andreoletti
  • 4,485
  • 4
  • 29
  • 51
0

Just query the event instance Cursor:

String query = "(" + CalendarContract.Instances.BEGIN + " >= ? ) AND (" + CalendarContract.Instances.END + " <= ? )";
String[] selectionArgs = new String[2];
selectionArgs[0] = startDate.getTime() + "";
selectionArgs[1] = endDate.getTime() + "";
ContentResolver cr = //getContentResolver
Cursor cur = cr.query(CalendarContract.Instances.CONTENT_URI, null, query, selectionArgs, null);
shem
  • 4,686
  • 2
  • 32
  • 43