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
Import a task
- Import the required classes and interfaces.
import java.io.ByteArrayInputStream; import javax.microedition.pim.PIM; import javax.microedition.pim.PIMItem; import javax.microedition.pim.ToDo; import javax.microedition.pim.ToDoList;
- Invoke PIM.getInstance().fromSerialFormat() to return an array of PIMItem objects. The enc parameter specifies the character encoding to use when writing to the output stream. Supported character encodings include "UTF8," "ISO-8859-1," and "UTF-16BE." This parameter cannot be null.
- Invoke ToDoList.importToDo()
to create a new task using the PIM items.
String[] dataFormats = PIM.toDoSerialFormats(); // Write task to serial format ByteArrayOutputStream os = new ByteArrayOutputStream(); PIM.getInstance().toSerialFormat(task, os, "UTF8", dataFormats[0]); // Import task from serial format ByteArrayInputStream is = new ByteArrayInputStream(outputStream.toByteArray()); PIMItem[] pi = PIM.getInstance().fromSerialFormat(is, "UTF8"); ToDoList todoList = (ToDoList)PIM.getInstance().openPIMList(PIM.TODO_LIST, PIM.READ_WRITE); ToDo task2 = todoList.importToDo((ToDo)pi[0]); task2.commit();
Next topic: Delete a task
Previous topic: Export a task