Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Josef and Isaac's solutions for accessing the calendar only work in Android 2.1 and earlier. Google have changed the base content URI in 2.2 from "content://calendar" to "content://com.android.calendar". This change means the best approach is to attempt to obtain a cursor using the old base URI, and if the returned cursor is null, then try the new base URI. </p> <p>Please note that I got this approach from the <a href="http://code.google.com/p/android-calendar-provider-tests/">open source test code</a> that Shane Conder and Lauren Darcey provide with their <a href="http://www.developer.com/ws/article.php/3850276/Working-with-the-Android-Calendar.htm">Working With The Android Calendar</a> article.</p> <pre><code>private final static String BASE_CALENDAR_URI_PRE_2_2 = "content://calendar"; private final static String BASE_CALENDAR_URI_2_2 = "content://com.android.calendar"; /* * Determines if we need to use a pre 2.2 calendar Uri, or a 2.2 calendar Uri, and returns the base Uri */ private String getCalendarUriBase() { Uri calendars = Uri.parse(BASE_CALENDAR_URI_PRE_2_2 + "/calendars"); try { Cursor managedCursor = managedQuery(calendars, null, null, null, null); if (managedCursor != null) { return BASE_CALENDAR_URI_PRE_2_2; } else { calendars = Uri.parse(BASE_CALENDAR_URI_2_2 + "/calendars"); managedCursor = managedQuery(calendars, null, null, null, null); if (managedCursor != null) { return BASE_CALENDAR_URI_2_2; } } } catch (Exception e) { /* eat any exceptions */ } return null; // No working calendar URI found } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload