09-24-2011 02:57 AM
Hi,
We are using BlackBerry Calendar Event for raisng alarm for our application events. We set the Date and Time and text that has to be displayed.
The problem we are facing is at one instance we have to delete a perticular Calendar event, by geting all the events that are register in the Calendar and searching that perticular event and delete it only. Please help us how to delete a perticular event /events one by one.( How search our event from all the calendar events)
Please find the below code that we are using for registering the Calendar event,.
public class CallAlrm
{
private Event event;
public void CallAlrm()
{
try
{
EventList eventList = (EventList)PIM.getInstance().openPIMList(PIM.EVENT _LIST, PIM.READ_WRITE);
BlackBerryEvent event = (BlackBerryEvent)eventList.createEvent();
if (eventList.isSupportedField(BlackBerryEvent.ALARM) )
{
event.addInt(BlackBerryEvent.ALARM, BlackBerryEvent.ATTR_NONE, 180);
}
event.addString(event.SUMMARY, PIMItem.ATTR_NONE, "My alarm");
event.addString(event.LOCATION, PIMItem.ATTR_NONE, "My Location");
event.addDate(event.END, PIMItem.ATTR_NONE,System.currentTimeMillis()+36000 0);
event.addDate(event.START, PIMItem.ATTR_NONE,System.currentTimeMillis()+12000 0);
event.commit();
}
catch(Exception e){}
}
}
Solved! Go to Solution.
09-26-2011 10:33 AM
Kindly Help
09-27-2011 06:26 AM
Please need some solution.
09-27-2011 04:21 PM
EventList.removeEvent can be used to delete a calendar event. You need to pass it the event you want to delete.
09-29-2011 09:36 AM
Hi MSohm,
Thank you for the reply. Actually can you tell how Pass the event that we want to delete.
09-29-2011 10:18 AM
If you have an instance of EventList called eventList and the event to be deleted called theEventToRemove, just call eventList.removeEvent(theEventToRemove).
09-29-2011 11:50 AM
I am unable to fetch the the EventToRemove list .
We are adding our events to the calendar and by default there will few events in the calendar from thoses events we should fetch our events. and delete them then how to fectc our events .
09-29-2011 01:32 PM
Use the EventList.items method to retrieve a list of events. You can then extract one of them to use to pass into the removeEvent method.
09-29-2011 01:36 PM
Can you please suggest a method to retrieve a list of events.
09-30-2011 08:07 AM
Can you please suggest a method to retrieve a list of events.