PIM - ToDo

22 May 2008

javax.microedition.pim.ToDo is an interface that extends from PIMItem. It represents a single ToDo item in a PIMToDo database. I will present an example of how to retrieve ToDo list from PIM.

Consider the following example. We create todos with fields of our interest. But before adding the field,w e should check if its supported on the platform or not.

ToDoList todos = null;
 try {
    todos = (ToDoList) PIM.getInstance().openPIMList(PIM.TODO_LIST, PIM.READ_WRITE);
 } catch (PIMException e) {
    // An error occurred
    return;
 }
 ToDo todo = todos.createToDo();
 if (todos.isSupportedField(Event.SUMMARY))
      todo.addString(ToDo.SUMMARY, PIMItem.ATTR_NONE, "Do shopping.");
 if (todos.isSupportedField(Event.DUE))
      todo.addDate(ToDo.DUE, PIMItem.ATTR_NONE, new Date().getTime());
 if (todos.isSupportedField(Event.NOTE))
      todo.addString(ToDo.NOTE, PIMItem.ATTR_NONE, "No NIKE stuff.");
 if (todos.isSupportedField(Event.PRIORITY))
      todo.addInt(ToDo.PRIORITY, PIMItem.ATTR_NONE, 2);
 if (todos.maxCategories() != 0 && todos.isCategory("Work"))
      todo.addToCategory("Work");
 }
 try {
      todo.commit();
 } catch (PIMException e) {
      // An error occured
 }
 try {
      todos.close();
 } catch (PIMException e) {
 }

Hope you’ll find this interesting.

del.icio.us:PIM - ToDo  digg:PIM - ToDo  spurl:PIM - ToDo  wists:PIM - ToDo  simpy:PIM - ToDo  newsvine:PIM - ToDo  blinklist:PIM - ToDo  furl:PIM - ToDo  reddit:PIM - ToDo  fark:PIM - ToDo  blogmarks:PIM - ToDo  Y!:PIM - ToDo  smarking:PIM - ToDo  magnolia:PIM - ToDo  segnalo:PIM - ToDo  gifttagging:PIM - ToDo

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: PIM - ToDo

Leave a Reply