Builds the Uri for Calendar events (as a Sync Adapter) - Android Android OS

Android examples for Android OS:Calendar Event

Description

Builds the Uri for Calendar events (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 events table */
    private static final Uri EVENT_URI = CalendarContract.Events.CONTENT_URI;

    /** Builds the Uri for events (as a Sync Adapter) */
    private static Uri buildEventUri(String accountName) {
        return EVENT_URI
                .buildUpon()/*from  w w w  .jav  a  2s  . co m*/
                .appendQueryParameter(
                        CalendarContract.CALLER_IS_SYNCADAPTER, "true")
                .appendQueryParameter(Calendars.ACCOUNT_NAME, accountName)
                .appendQueryParameter(Calendars.ACCOUNT_TYPE,
                        CalendarContract.ACCOUNT_TYPE_LOCAL).build();
    }
}

Related Tutorials