delete Calendar With Name - Android Android OS

Android examples for Android OS:Calendar Name

Description

delete Calendar With Name

Demo Code


//package com.java2s;

import android.content.Context;

import android.net.Uri;
import android.provider.CalendarContract;

import android.provider.CalendarContract.Calendars;

public class Main {
    public static int deleteCalendarWithName(Context ctx, String name) {

        Uri target = Uri.parse(CalendarContract.Calendars.CONTENT_URI
                .toString());//  www . ja v a2  s .  co m
        target = target
                .buildUpon()
                .appendQueryParameter(
                        CalendarContract.Calendars.ACCOUNT_TYPE,
                        CalendarContract.ACCOUNT_TYPE_LOCAL).build();

        return ctx.getContentResolver().delete(target,
                Calendars.NAME + "=?", new String[] { name });
    }
}

Related Tutorials