View or change a 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 and store it in an Enumeration.
    ToDoList tdl = (ToDoList)PIM.getInstance().openPIMList(PIM.TODO_LIST, 
       PIM.READ_WRITE);
    Enumeration todos = tdl.items();
    
  3. Create a ToDo object using an element from the Enumeration.
    ToDo todo = (ToDo)todos.nextElement();
  4. Invoke Invoke.invokeApplication() using the APP_TYPE_TASKS field, and a new TaskArguments object created using the ARG_VIEW field and the ToDo object.
    Invoke.invokeApplication(Invoke.APP_TYPE_TASKS, 
       new TaskArguments(TaskArguments.ARG_VIEW, todo));
    
Previous topic: Task list

Was this information helpful? Send us your comments.