· 7 years ago · Oct 17, 2018, 02:40 PM
1// Selecting only calendars from gmail or goggle group.
2String selection = "("+Calendar.CalendarColumns.ID +
3 " LIKE ?) OR (" +
4 Calendar.CalendarColumns.ID +
5 " LIKE ?)";
6String[] selectionArgs = new String[] { "%@gmail.com",
7 "%@group.calendar.google.com"
8 };
9
10Cursor cur = Calendars.query(getContext().getContentResolver(),
11 null,
12 selection,
13 selectionArgs,
14 "name"
15 );
16
17while (cur.moveToNext()) {
18 for (int i = 0; i <cur.getColumnCount(); i++) {
19 Log.d(TAG, cur.getColumnName(i) + " : " + cur.getString(i));
20
21 // Do something with the values of all columns returned.
22 }
23}