Troubleshooting guide

178
BlackBerry Java Development Environment Development Guide
Using tasks
Start the task application from your application
Check for a ControlledAccessException if your application invokes a BlackBerry® application that you do not
have permission to use or access.
Task Steps
Open the task application. The TaskArguments (net.rim.blackberry.api.invoke.TaskArguments) cannot be updated without
changes to the task application.
>Invoke Invoke.invokeApplication(APP_TYPE_TASKS, TaskArguments).
View or change a task. 1. 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();
2. Create a ToDo object using an element from the Enumeration:
ToDo todo = (ToDo)todos.nextElement();
3. Invoke invokeApplication() using the APP_TYPE_TASKS constant parameter, and a new
TaskArguments object created using the ARG_VIEW parameter and the ToDo object.
Invoke.invokeApplication(Invoke.APP_TYPE_TASKS, new
TaskArguments(TaskArguments.ARG_VIEW, todo));
Create a new blank task. >Invoke invokeApplication() using the APP_TYPE_TASKS constant parameter, and a new
TaskArguments object created using the ARG_NEW parameter.
Invoke.invokeApplication(Invoke.APP_TYPE_TASKS, new TaskArguments(
TaskArguments.ARG_NEW) );
Create a new populated task. 1. Create an instance of a ToDoList.
ToDoList tdl = (ToDoList)PIM.getInstance().openPIMList(PIM.TODO_LIST,
PIM.READ_WRITE);
2. 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");
3. Invoke invokeApplication() using the APP_TYPE_TASKS constant parameter, and a new
TaskArguments object created using the ARG_NEW parameter and the new ToDo object.
Invoke.invokeApplication(Invoke.APP_TYPE_TASKS, new TaskArguments(
TaskArguments.ARG_NEW, todo));