Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
bb2010
Posts: 157
Registered: ‎03-29-2010
My Device: 8300
Accepted Solution

Delete event in Calendar one by one.

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()+360000);
            event.addDate(event.START, PIMItem.ATTR_NONE,System.currentTimeMillis()+120000);
           
               
            event.commit();
        }
        catch(Exception e){}   
    }
}

 

Please use plain text.
Developer
bb2010
Posts: 157
Registered: ‎03-29-2010
My Device: 8300

Re: Delete event in Calendar one by one.

 

Kindly Help

Please use plain text.
Developer
bb2010
Posts: 157
Registered: ‎03-29-2010
My Device: 8300

Re: Delete event in Calendar one by one.

Please need some solution.

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Delete event in Calendar one by one.

EventList.removeEvent can be used to delete a calendar event.  You need to pass it the event you want to delete.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
bb2010
Posts: 157
Registered: ‎03-29-2010
My Device: 8300

Re: Delete event in Calendar one by one.

Hi MSohm,

 

Thank you for the reply. Actually can you tell how Pass the event that we want to delete.

 

 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Delete event in Calendar one by one.

If you have an instance of EventList called eventList and the event to be deleted called theEventToRemove, just call eventList.removeEvent(theEventToRemove).

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
bb2010
Posts: 157
Registered: ‎03-29-2010
My Device: 8300

Re: Delete event in Calendar one by one.

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 .

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Delete event in Calendar one by one.

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.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
bb2010
Posts: 157
Registered: ‎03-29-2010
My Device: 8300

Re: Delete event in Calendar one by one.

Can you please suggest a method to retrieve a list of events.

Please use plain text.
Developer
bb2010
Posts: 157
Registered: ‎03-29-2010
My Device: 8300

Re: Delete event in Calendar one by one.

Can you please suggest a method to retrieve a list of events.

Please use plain text.