BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   Accessing Start and End time field of the calent event (http://www.blackberryforums.com/developer-forum/217523-accessing-start-end-time-field-calent-event.html)

imran2k1 01-22-2010 01:02 AM

Accessing Start and End time field of the calent event
 
hi all
i am getting problem to access the start and end time field of the calendar event. i am using below code in that i am getting some field like subject and notes, but i am not getting start, end time field and "start time as" field.
if any one know please help me.
Code:

EventList eventlist=null;
Enumeration e;

try{
               
                eventlist =(EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE);
        }
        catch(PIMException e){
               
        }
try {
                e= eventlist.items();
               
               
        //        e= eventlist.items(EventList.STARTING, startDate, endDate, true);
               
               
               
        } catch (PIMException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
        }
       
        while (e.hasMoreElements()) {
                Event event1 = (Event)e.nextElement();
                int[] fieldIds = event1.getFields();
                int xxx=fieldIds.length;
                int id;
                for(int index = 0; index < fieldIds.length; ++index) {
                id = fieldIds[index];
                if(event1.getPIMList().getFieldDataType(id) == PIMItem.STRING) {
                       
                        System.out.println(eventlist.getFieldLabel(id).toString());  // 0-4, free to busy giving the field information
       
                        for(int j=0; j < event1.countValues(id); ++j) {
               
                                String value = event1.getString(id, j);
                        System.out.println(event1.getFields() + "=" + value);
       
       
                }
       
                }
                }
                }
       
        try{
               
                eventlist.close();
        }catch(Exception e){
                Dialog.alert("Error in close:"+e);
        }
       
       
        }

is am i doing any wrong?
or any other way to retrieve the "start time", "end time" and "start time as" field data?

Thanks and regards
Imran ali

Smiley8 01-23-2010 10:55 AM

use this method

start = event1.getDate(Event.START, 0)

end = event1.getDate(Event.END, 0)


All times are GMT -5. The time now is 02:27 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.