Open a new populated calendar entry

  1. Import the required classes and interfaces.
    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. Create a new Event using an EventList object.
    EventList el = (EventList)PIM.getInstance().openPIMList( PIM.EVENT_LIST, PIM.READ_WRITE );
    Event e = el.createEvent();
  3. Add information to the Event object.
    e.addString( Event.SUMMARY, 0, "Go For A Walk" );
    e.addString( Event.LOCATION, 0, "The Park" );
    long start = System.currentTimeMillis() + 8640000;
    e.addDate( Event.START, 0, start );
    e.addDate( Event.END, 0, start + 72000000 );
  4. Invoke Invoke.invokeApplication(APP_TYPE_CALENDAR, CalendarArguments) using the CalendarArguments object created using the ARG_NEW field and the Event.
    Invoke.invokeApplication( Invoke.APP_TYPE_CALENDAR, new CalendarArguments( CalendarArguments.ARG_NEW, e ) ); 

Was this information helpful? Send us your comments.