Back to project page android-calendar-drafts.
The source code is released under:
Apache License
If you think the Android project android-calendar-drafts listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.touchableheroes.drafts.calendar.cmd; /*from w w w . j a va 2 s.c o m*/ import java.util.TimeZone; import com.touchableheroes.drafts.calendar.dao.EventId; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Activity; import android.content.ContentResolver; import android.content.ContentValues; import android.net.Uri; import android.provider.CalendarContract.Events; import android.util.Log; /** * Modifies an existing event in default-calendar. * * @author A. Siebert / ask@touchableheroes.com */ @TargetApi(14) public class ModifyEventCmd extends ContextCmd { public ModifyEventCmd(final Activity ctx) { super(ctx); } @SuppressLint("InlinedApi") public boolean exec(final long id, final long calenderId, final long start, final long end, final String title, final String description) { final Uri idUri = EventId.createUri( id ); final ContentResolver cr = getContentResolver(); final ContentValues values = new ContentValues(); values.put(Events.CALENDAR_ID, calenderId); values.put(Events.DTSTART, start); values.put(Events.DTEND, end); values.put(Events.ALL_DAY, 0); values.put(Events.TITLE, title); values.put(Events.DESCRIPTION, description); final TimeZone zone = TimeZone.getDefault(); values.put(Events.EVENT_TIMEZONE, zone.getID()); final int count = cr.update(idUri, values, null, null); Log.d("phonegap-calendar-plugin", "updated: " + count + " events in calendar." ); return (count > 0); } }