read

You can use the next method:

<pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"> public static void add(Activity activity, String title, String description, Calendar initDate, Calendar finalDate) {
final String baseUriCalendar = getCalendarUriBase();
final Uri EVENTS_URI = Uri.parse(baseUriCalendar + "//events");
final ContentResolver cr = activity.getContentResolver();
// event insert
ContentValues values = new ContentValues();
values.put("calendar_id", 1);values.put("title", title);
values.put("allDay", 0);
values.put("dtstart", initDate.getTimeInMillis());
values.put("dtend", finalDate.getTimeInMillis());
values.put("description", description);values.put("visibility", 0);
values.put("hasAlarm", 1);
final Uri event = cr.insert(EVENTS_URI, values);// reminder insert
final Uri REMINDERS_URI = Uri.parse(baseUriCalendar + "//reminders");
values = new ContentValues();
values.put("event_id", Long.parseLong(event.getLastPathSegment()));
values.put("method", 1);
values.put("minutes", 10);
cr.insert(REMINDERS_URI, values);
}
</pre>

Blog Logo

Daniel Gomez Rico


Published

Image

MakinGIANTS

The findings and tips records of an Android-iOS-TheWholeShabang group

Back to Overview