Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should test, if an instance for this event exists. See the <a href="https://developer.android.com/reference/android/provider/CalendarContract.Instances.html" rel="noreferrer">documentation of the Android's CalendarContract.Instances class</a>.</p> <p>Especially the <a href="https://developer.android.com/reference/android/provider/CalendarContract.Instances.html#query%28android.content.ContentResolver,%20java.lang.String%5B%5D,%20long,%20long,%20java.lang.String%29" rel="noreferrer">second query method</a> should be helpful in this case.</p> <p>This examples is some code, I posted on my <a href="http://www.grokkingandroid.com/androids-calendarcontract-provider/" rel="noreferrer">blog post about the CalendarContract provider</a> - slightly altered for your needs:</p> <pre class="lang-java prettyprint-override"><code>long begin = // starting time in milliseconds long end = // ending time in milliseconds String[] proj = new String[]{ Instances._ID, Instances.BEGIN, Instances.END, Instances.EVENT_ID}; Cursor cursor = Instances.query(getContentResolver(), proj, begin, end, "\"Your event title\""); if (cursor.getCount() &gt; 0) { // deal with conflict } </code></pre> <p>Be aware: The time is always in UTC millis since the epoch. So you might have to adjust given the user's timezone.</p> <p>And the last parameter should contain the title of the event you have added to the calendar. Keep the quotes - otherwise Android looks for "your" or "event" or "title"!</p> <p>And do not forget to include the necessary permissions.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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