Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE Integration Manual page 41

Blackberry device applications integration guide
Table of Contents

Advertisement

Task
Change task information.
Save a task.
Retrieve task information.
Steps
1. To replace an existing value with a new value, invoke the appropriate set method, such as
setString()
.
2. To determine if a value is already set for the field, invoke
3. To change an existing value, use the corresponding
4. Create code to manage a
throws when a value already exists.
if (task.countValues(ToDo.SUMMARY) > 0) {
task.setString(ToDo.SUMMARY, 0, ToDo.ATTR_NONE, "Review notes");
}
1. Before you commit your changes, to determine whether any task fields have changed since the
task was last saved, invoke
commit()
2. Invoke
.
if(task.isModified()) {
task.commit();
}
1. To retrieve an enumeration, invoke
ToDoList todoList = (ToDoList)PIM.getInstance().openToDoList(
PIM.TODO_LIST, PIM.READ_ONLY);
Enumeration enum = todoList.items();
2. To retrieve an array of IDs for fields that have data for a particular
PIMItem.getFields()
3. To retrieve the field values, invoke
while (enum.hasMoreElements()) {
ToDo task = (ToDo)enum.nextElement();
int[] fieldIds = task.getFields();
int id;
for(int index = 0; index < fieldIds.length; ++index) {
id = fieldIds[index];
if(task.getPIMList().getFieldDataType(id) == STRING) {
for(int j=0; j < task.countValues(id); ++j) {
String value = task.getString(id, j);
System.out.println(task.getFieldLable(id) + "=" + value);
}
}
}
}
set()
FieldFullException
which a method such as
isModified()
PIMList.items()
.
PIMItem.getString().
4: Using tasks
countValues()
.
method.
addString()
on the task list.
ToDo
item, invoke
41

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment 4.6.0

Table of Contents