Add task information

  1. Import the required classes and interfaces.
    import java.util.Date;
    import javax.microedition.pim.PIMList;
    import javax.microedition.pim.ToDo;
    import javax.microedition.pim.ToDoList;
  2. Before you set or retrieve a field, verify that the item supports the field by invoking ToDoList.isSupportedField(int).
  3. Invoke PIMList.getFieldDataType(int) to retrieve the field data type.
  4. Invoke one of the following methods to set the field data:
    • addString()
    • addDate()
    • addInt()
    • addBoolean()
    • addBinary()
    if (todoList.isSupportedField(ToDo.SUMMARY)) 
       task.addString(ToDo.SUMMARY, ToDo.ATTR_NONE, "Create project plan");
    if (todoList.isSupportedField(ToDo.DUE)) 
       Date date = new Date();
       task.addDate(ToDo.DUE, ToDo.ATTR_NONE, (date + 17280000));
    if (todoList.isSupportedField(ToDo.NOTE)) 
       task.addString(ToDo.NOTE, ToDo.ATTR_NONE, "Required for meeting");
    if (todoList.isSupportedField(ToDo.PRIORITY)) 
       task.addInt(Todo.PRIORITY, ToDo.ATTR_NONE, 2);
Previous topic: Create a task

Was this information helpful? Send us your comments.