Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>manifest</code></p> <pre><code>&lt;uses-permission android:name="android.permission.READ_CALENDAR" /&gt; </code></pre> <p>These examples are for &lt;= 2.1 version; </p> <p>first; find out which calendars exist</p> <pre><code>Cursor cursor = cr.query(Uri.parse("content://calendar/calendars"), new String[]{ "_id", "displayname" }, null, null, null); cursor.moveToFirst(); String[] CalNames = new String[cursor.getCount()]; int[] CalIds = new int[cursor.getCount()]; for (int i = 0; i &lt; CalNames.length; i++) { CalIds[i] = cursor.getInt(0); CalNames[i] = cursor.getString(1); cursor.moveToNext(); } cursor.close(); </code></pre> <p>Fetching all events, and particular event is done by specifying range<br> <code>ContentResolver contentResolver = getContentResolver()</code>;</p> <pre><code>Uri.Builder builder = Uri.parse(getCalendarUriBase() + "/instances/when").buildUpon(); long now = new Date().getTime(); ContentUris.appendId(builder, now - DateUtils.MILLIS_PER_DAY*10000); ContentUris.appendId(builder, now + DateUtils.MILLIS_PER_DAY * 10000); </code></pre> <p>and then let's say you wish to log events ID from calendar with ID = 1</p> <pre><code>Cursor eventCursor = contentResolver.query(builder.build(), new String[] { "event_id"}, "Calendars._id=" + 1, null, "startDay ASC, startMinute ASC"); // For a full list of available columns see http://tinyurl.com/yfbg76w while (eventCursor.moveToNext()) { String uid2 = eventCursor.getString(0); Log.v("eventID : ", uid2); } </code></pre> <p>and for some <em>source code</em> check <a href="http://jimblackler.net/blog/?p=151" rel="nofollow noreferrer">Jim Blackler's <em>Accessing the internal calendar database inside Google Android applications</em></a> and <a href="https://stackoverflow.com/questions/4302209/android-calendar-events">Android Calendar Events</a></p>
 

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