Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Add a PIM item to a custom category

by BlackBerry Development Advisor ‎02-16-2010 01:09 PM - edited ‎09-16-2010 02:59 PM

Summary

 

This article applies to the BlackBerry® Java® Development Environment (JDE) 4.1 and later.

 


Description

 

A custom or new category can be added to the following PIMItem interfaces during creation:

 

  • Contact
  • ToDo
  • Memo (as of BlackBerry JDE 4.2)

For these interfaces, there are two default categories available: Personal and Business.

 

To add a custom category, the category must be first added to the PIMList, and only then can be added to the PIMItem itself.

 

For example, using the javax.microedition.pim.ContactList and javax.microedition.pim.Contact interfaces:

 

 

ContactList contactList = (ContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.WRITE_ONLY);
Contact contact = contactList.createContact();
// Adds the category inputted to the ContactList.

contactList.addCategory("MyCategory");



// Adds the same category inputted to the contact.

contact.addToCategory("MyCategory");

 

If the category is not added to the PIMList prior to attempting to add it to the PIMItem, a PIMException will be thrown.

Contributors