Actually i have created an app from which i can stored notes to my device calendar..now there may be cases where i want to chnage my notes and again want to save in the device calender..so all works fine..but what i want is when i stored new data from my app to device calendar the data previously present is removed from the device calendar and most importantly only the data that are removed are those data that are inserted by my app not the data already present in device calendar by someone..i mean to say it removed data and insert new data that are given by my app.. The code i have written for storing data in device calendar is shown below..whenever this function is called i want to delete all my previously saved data from my app..
public void setAlertOnDevice()
{
Date dtStartDate = CycleManager.getSingletonObject().getStartDate();
boolean bDeleteAndReturn = false;
Calendar cal = Calendar.getInstance();
if (dtStartDate.getTime() == CycleManager.getSingletonObject().getDefaultDate().getTime())
{
bDeleteAndReturn = true;
dtStartDate = cal.getTime();
}
getOffsetsForCycleStages(CycleManager.getSingletonObject().iAvgCycleTime);
if(bDeleteAndReturn==false)
{
if (CycleManager.getSingletonObject().bNextCycleAlert && iStart>0)
{
cal.setTime(dtStartDate);
cal.add(Calendar.DATE, iStart);
Uri EVENTS_URI = Uri.parse(getCalendarUriBase(this) + "events");
ContentResolver cr = getContentResolver();
String str="SeeCycles: Start";
String strDescription="Cycle expected today. On start, enter the date into SeeCycles";
ContentValues values = new ContentValues();
values.put("calendar_id", 1);
values.put("title", str);
values.put("description", strDescription);
values.put("dtstart", cal.getTimeInMillis());
values.put("dtend", cal.getTimeInMillis());
cr.insert(EVENTS_URI, values);
}
}
Use the Google Calendar GData API if you wish to modify the user’s Google Calendar, please.