PIM - ToDo
22 May 2008javax.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.
Related Posts:
- Implementing more than one Interfaces
- Annotating an annotation- III
- Custom annotations - Adding a member - I
- Custom annotations - Adding a member - II
- Extract superclass(I)
- Extract superclass(II)
- Compiling a Java class using JavaCompiler - II
- Object references (I)
- Compiling a Java class using JavaCompiler
- JSR 75 (I)
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