Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EventList Read/Write

 
Vishal Patel
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing an application that read anw write EventList on mobile.

But one problem in reading this.

The Program can't read the data.

The program is like this.

Please help me.

public void show_EVENT_LIST()
{
System.out.println("show_EVENT_LIST");

try
{
EventList events;
PIM pim = PIM.getInstance();
events = (EventList)pim.openPIMList(PIM.EVENT_LIST,PIM.READ_ONLY);

Event event;
Enumeration enum = events.items();

while( enum.hasMoreElements())
{
event = (Event) enum.nextElement();

int field[] = event.getFields();

System.out.println("field.length >" + field.length);

for(int i=0;i<field.length;i++)
{
if(events.isSupportedField(field[i]))
{
int index[] = events.getSupportedAttributes(field[i]);

System.out.println(events.getFieldLabel(field[i]));

for(int j=0;j<index.length;j++)
{
if(events.isSupportedAttribute(field[i],index[j]))
{
System.out.print(events.getAttributeLabel(index[j])+" > ");

switch(events.getFieldDataType(field[i]))
{
case PIMItem.INT:
System.out.println(event.getInt(field[i],index[j]));
break;
case PIMItem.DATE:
System.out.println(new Date(event.getDate(field[i],index[j])));
break;
case PIMItem.STRING:
System.out.println((String)event.getString(field[i],j));
break;
default:
System.out.println("default");
break;
}
break;
}
}
}
}
event = null;
}

events.close();

}
catch (UnsupportedFieldException e){System.out.println("Event not saved");}
catch (PIMException e){System.out.println("Exception occured in add_EVENT_LIST() ");}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic