Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
sreehari434
Posts: 28
Registered: ‎05-25-2009
My Device: Not Specified

Reading calender events

 

	   public void readPIMEvents() {
		   System.out.println("entered into read") ;
		   try {
			           EventList eventList = (EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_ONLY);
					   Enumeration e = eventList.items();
					   while (e.hasMoreElements())

					   {

					      

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

					   int[] fieldIds = event.getFields();

					   int id;

					   for(int index = 0; index < fieldIds.length; ++index)

					   {

					   Dialog.alert("in for");

					   id = fieldIds[index];
					   
					   Dialog.alert("hello"+ event.getPIMList().getFieldDataType(id));

					   for(int j=0; j < event.countValues(id); ++j) 
					   {

					   String value = event.getString(id, j);
                     
					   Dialog.alert(eventList.getFieldLabel(id)+"="+value);

					   }

					    

					   }

					   }
		   }
		   catch(PIMException ds) {
			   System.out.println("Exception::"+ds.getMessage().toString());
		   }
	   }

 

Hi,

 

        i am using the given below code for reading calander events but its read only summery and location but i need to acees all the details associated wiyh calander events.please help me.

 

 

 

New Developer
ganeshS
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Re: Reading calender events

Hello sreehari434,

 

I am not sure but I think you can't access all the fields. But you can access StartTime and EndTime.

 

The code for Accessing start time and end time is as follows

_startTime = new DateField("Start: ", System.currentTimeMillis() +
3600000, DateField.DATE_TIME);
_endTime = new DateField("End: ", System.currentTimeMillis() +
7200000, DateField.DATE_TIME);

 

 

New Developer
sreehari434
Posts: 28
Registered: ‎05-25-2009
My Device: Not Specified

Re: Reading calender events

hi,

        this code just give time but i need start and end time of each events i am reading.please help me.

Developer
Eugen
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE

Re: Reading calender events

Hi guys,

 

start_date and end_date are long values. You should use PIMItem.getDate() instead of PIMItem.getString(). You can also check field type by PIMEvent.getFieldDataType().

 

Thanks,

Eugen