Help Center
Local Navigation
- Integrating with BlackBerry Device Software applications
- Unified search
- Device interaction support
- Message list
- Custom messages
- Attachments
- Calendar
- Contact list
-
Task list
- View or change a task
- Create a new blank task
- Create a new populated task
- Open a task list
- Create a task
- Add task information
- Change task information
- Save a task
- Retrieve task information
- Export a task
- Import a task
- Delete a task
- Close the task list
- Notify a BlackBerry device application when a list of tasks changes
- Phone
- BlackBerry Browser
- Menu items
- Find more information
- Glossary
- Provide feedback
- Document revision history
- Legal notice
BlackBerry Manuals & Help
>
Developer Documentation
>
Java Development Guides and API Reference
>
Development Guide
Integration - BlackBerry Java SDK - 6.0
Retrieve task information
- 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;
- Invoke ToDoList.items() on the task list
to retrieve an enumeration.
ToDoList todoList = (ToDoList)PIM.getInstance().openToDoList(PIM.TODO_LIST, PIM.READ_ONLY); Enumeration enum = todoList.items();
- Invoke ToDo.getFields() to retrieve an array of IDs for fields that have data for a particular ToDo item.
- Invoke PIMItem.getString()
to retrieve the field values.
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); } } } }
Next topic: Export a task
Previous topic: Save a task