1

I am trying to list all the events from a native calendar using the code below. I am getting an object, and I want the exact event string. I have set a meeting in my calendar and I want to read the same.

  private void getEvents() {
                try {       

                          EventList eventList = (EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_ONLY);

                          Enumeration events = eventList.items()

                          while (events.hasMoreElements()) {



                            Event event = (Event)events.nextElement();



                            Dialog.alert(event.toString());

                          }



                        } catch (PIMException e) {



                          Dialog.alert(e.getMessage());

                        }

        }

I have added a meeting as a event in calendar and i want to read this.

pihu
  • 93
  • 1
  • 11
user1195292
  • 233
  • 1
  • 3
  • 13

1 Answers1

0

I'm not sure exactly what you want but for example if you wanted to read the subject line you could do something like this:

if(eventList.isSupportedField(BlackBerryEvent.SUMMARY) && event.countValues(BlackBerryEvent.SUMMARY) > 0) {
    subject = event.getString(BlackBerryEvent.SUMMARY, 0); 
}
mparizeau
  • 663
  • 5
  • 12
  • this works and gett eh subject data from calendar,isnt there way to get all info related to meeting in one go? – user1195292 Mar 06 '12 at 09:33
  • I don't think you can, but I'm not sure what kind of format you're wanting the information in. As part of the meeting there is data in the form of String, ints and longs so you'll probably have to grab everything you want individually and combine them how you want. – mparizeau Mar 07 '12 at 00:04
  • I've never used it before but the items method on [EventList](http://www.blackberry.com/developers/docs/7.0.0api/javax/microedition/pim/EventList.html) might be what you're looking for – mparizeau Mar 10 '12 at 03:33