Builds the Uri for your Calendar in android database (as a Sync Adapter) - Android android.provider

Android examples for android.provider:CalendarContract

Description

Builds the Uri for your Calendar in android database (as a Sync Adapter)

Demo Code


//package com.java2s;

import android.net.Uri;

import android.provider.CalendarContract;

import android.provider.CalendarContract.Calendars;

public class Main {
    /** The main/basic URI for the android calendars table */
    private static final Uri CAL_URI = CalendarContract.Calendars.CONTENT_URI;

    /** Builds the Uri for your Calendar in android database (as a Sync Adapter) */

    private static Uri buildCalUri(String accountName) {
        return CAL_URI
                .buildUpon()/*  ww w .  j  a  va 2s.c  o  m*/
                .appendQueryParameter(
                        CalendarContract.CALLER_IS_SYNCADAPTER, "true")
                .appendQueryParameter(Calendars.ACCOUNT_NAME, accountName)
                .appendQueryParameter(Calendars.ACCOUNT_TYPE,
                        CalendarContract.ACCOUNT_TYPE_LOCAL).build();
    }
}

Related Tutorials