View RSS Feed

My Java Tips

PIM - ToDo

Rate this Entry
by , 11-06-2011 at 07:04 PM (788 Views)
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.

Java Code:
ToDoList todos = null;
 try {
    todos = (ToDoList) PIM.getInstance().openPIMList(PIM.TODO_LIST, PIM.READ_WRITE);
 } catch (PIMException e) {
    // An error occurred
 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"))
 try {
 } catch (PIMException e) {
      // An error occured
 try {
 } catch (PIMException e) {
Hope you'll find this interesting.

Submit "PIM - ToDo" to Facebook Submit "PIM - ToDo" to Digg Submit "PIM - ToDo" to Submit "PIM - ToDo" to StumbleUpon Submit "PIM - ToDo" to Google

Tags: None Add / Edit Tags
Java ME