get Calendar Content Values - Android android.provider

Android examples for android.provider:ContactsContract

Description

get Calendar Content Values

Demo Code


//package com.java2s;

import android.content.ContentValues;

import android.provider.CalendarContract;

import android.provider.CalendarContract.Calendars;

public class Main {
    private static ContentValues getCalendarContentValues(
            String calendarName, String accountName) {

        final ContentValues cv = new ContentValues();
        cv.put(Calendars.ACCOUNT_NAME, accountName);
        cv.put(Calendars.ACCOUNT_TYPE, CalendarContract.ACCOUNT_TYPE_LOCAL);
        cv.put(Calendars.NAME, calendarName);
        cv.put(Calendars.CALENDAR_DISPLAY_NAME, calendarName);
        cv.put(Calendars.CALENDAR_COLOR, 0xEA8561);
        // user can only read the calendar
        cv.put(Calendars.CALENDAR_ACCESS_LEVEL, Calendars.CAL_ACCESS_OWNER);
        cv.put(Calendars.OWNER_ACCOUNT, accountName);
        cv.put(Calendars.VISIBLE, 1);//from ww w  . j a  v  a  2  s.c  om
        cv.put(Calendars.SYNC_EVENTS, 1);
        return cv;
    }
}

Related Tutorials