View or change a calendar entry

  1. Import the required classes and interfaces.
    import java.util.Enumeration;
    import javax.microedition.pim.PIM;
    import javax.microedition.pim.Event;
    import javax.microedition.pim.EventList;
    import net.rim.blackberry.api.invoke.CalendarArguments;
    import net.rim.blackberry.api.invoke.Invoke;
    import net.rim.device.api.system.ControlledAccessException;
  2. Retrieve an Event from the list of events.
    Event e = null;
    EventList el = 
      (EventList)PIM.getInstance().openPIMList( PIM.EVENT_LIST, PIM.READ_WRITE );
    Enumeration events = el.items();
    e = (Event)events.nextElement();
  3. Invoke Invoke.invokeApplication(APP_TYPE_CALENDAR, CalendarArguments) using the CalendarArguments object created using the ARG_VIEW_DEFAULT field and the retrieved Event.
    Invoke.invokeApplication( Invoke.APP_TYPE_CALENDAR, new CalendarArguments( CalendarArguments.ARG_VIEW_DEFAULT, e ) );
  4. Check for a ControlledAccessException if your application does not have permission to access the application that it invokes.
Previous topic: Open the calendar

Was this information helpful? Send us your comments.