Retrieve calendar entry information

  1. Import the required classes and interfaces.
    javax.microedition.pim.Event
    javax.microedition.pim.EventList
    javax.microedition.pim.PIM
    
  2. Invoke EventList.items() to retrieve an enumeration of appointments.
    EventList eventList = 
      (EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_ONLY); 
    Enumeration e = eventList.items();
  3. Invoke PIMItem.getFields() to retrieve an array of IDs of fields that have data for a particular task. Invoke PIMItem.getString() to retrieve the field values.
    while (e.hasMoreElements()) 
    {
       Event event = (Event)e.nextElement();
       int[] fieldIds = event.getFields();
       int id;
       for(int index = 0; index < fieldIds.length; ++index) 
       {
          id = fieldIds[index];
          if(e.getPIMList().getFieldDataType(id) == STRING) 
          {
             for(int j=0; j < event.countValues(id); ++j) 
             {
                String value = event.getString(id, j);
                System.out.println(event.getFieldLable(id) + "=" + value);
             }
          }
       }
    }

Was this information helpful? Send us your comments.