Create a new populated task

  1. Import the required classes and interfaces.
    import java.util.Enumeration;
    import javax.microedition.pim.PIM;
    import javax.microedition.pim.ToDo;
    import javax.microedition.pim.ToDoList;
    import net.rim.blackberry.api.invoke.Invoke;
    import net.rim.blackberry.api.invoke.TaskArguments;
  2. Create an instance of a ToDoList.
    ToDoList tdl = (ToDoList)PIM.getInstance().openPIMList(PIM.TODO_LIST, 
  3. Invoke createToDo() to create a new ToDo object and add information to the new ToDo object.
    ToDo todo = tdl.createToDo();
    todo.addString(ToDo.SUMMARY, 0, "Walk the Dog");
  4. Invoke Invoke.invokeApplication() using the APP_TYPE_TASKS field, and a new TaskArguments object created using the ARG_NEW field and the new ToDo object.
       new TaskArguments( TaskArguments.ARG_NEW, todo));
Next topic: Open a task list
Previous topic: Create a new blank task

Was this information helpful? Send us your comments.