39
4: Using tasks
Using tasks
Start the task application from your BlackBerry Java Application
Check for a
ControlledAccessException
if your BlackBerry® Java® 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));
Summary of Contents for JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE
Page 4: ......
Page 7: ......
Page 10: ...10 BlackBerry Device Applications Integration Guide...
Page 12: ...12 BlackBerry Device Applications Integration Guide...
Page 50: ...50 BlackBerry Device Applications Integration Guide...
Page 56: ...56 BlackBerry Device Applications Integration Guide...
Page 65: ......
Page 66: ...2008 Research In Motion Limited Published in Canada...