add Reminder to Calendar - Android Android OS

Android examples for Android OS:Calendar Contract

Description

add Reminder to Calendar

Demo Code


//package com.java2s;
import android.content.ContentResolver;

import android.content.ContentValues;
import android.content.Context;

import android.provider.CalendarContract.Reminders;

public class Main {
    public static void addReminder(Context ctx, long eventID, long minutes)
            throws Exception {
        ContentResolver cr = ctx.getContentResolver();
        ContentValues values = new ContentValues();
        values.put(Reminders.MINUTES, minutes);
        values.put(Reminders.EVENT_ID, eventID);
        values.put(Reminders.METHOD, Reminders.METHOD_ALERT);
        cr.insert(Reminders.CONTENT_URI, values);
    }// w  ww.  j a v  a  2  s  . c  o  m
}

Related Tutorials