You'll have to query the CalendarProvider (available since API level 14)'s Calendars table for available calendars. The following snippet will show you how:
final String[] EVENT_PROJECTION = new String[]{
CalendarContract.Calendars._ID,
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
CalendarContract.Calendars.CALENDAR_COLOR
};
final ContentResolver cr = getContentResolver();
final Uri uri = CalendarContract.Calendars.CONTENT_URI;
Cursor cur = cr.query(uri, EVENT_PROJECTION, null, null, null);
final List<CalendarInfo> result = Lists.newArrayList();
while (cur.moveToNext()) {
/* do something with the cursor:
Long id = cur.getLong(0);
String name = cur.getString(1);
int color = cur.getInt(2);
*/
}
Since you're doing IO work (providers are basically SQLite databases), it's a solid idea to wrap everything into a separate (non-UI) thread; I'd go with RxJava.
If you don't like playing with cursors, queries and boilerplate code, use the CalendarWrapper library. It takes care of mapping objects and database rows to and from, CRUD operations can be performed with object methods. For example in your case a single line would do the magic:
final List<Calendar> calendars = Calendar.getCalendarsForQuery(null, null, null, getContentResolver());
After you get a hold of the available calendars, just put them in a list and show it in a dialog, that's the easiest way.