Deletes the calendar from google calendar - Android Account

Android examples for Account:Google Account

Description

Deletes the calendar from google calendar

Demo Code


//package com.java2s;
import android.annotation.TargetApi;

import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.provider.CalendarContract;

public class Main {
    private static final String ACCOUNT_NAME = "TUM_Campus_APP";

    /**/* w ww  .  j  a va 2s  .co m*/
     * Deletes the calendar TUM_Campus_APP from google calendar
     * @param c Context
     * @return Number of rows deleted
     */
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public static int deleteCalendar(Context c) {
        Uri uri = CalendarContract.Calendars.CONTENT_URI;
        return c.getContentResolver().delete(uri,
                " account_name = '" + ACCOUNT_NAME + "'", null);
    }
}

Related Tutorials