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.

inside custom component

Java Development

Reply
Developer
Posts: 88
Registered: ‎07-11-2009
My Device: Not Specified

Adding a Note and a Website URL to a contact

Hi, I have the following code to set the website URL of a Contact and will use Contact.NOTE to create a note.

 

 

if(contactList.isSupportedField(Contact.URL) && contactList.isSupportedAttribute(Contact.URL, Contact.ATTR_WORK)){ contact.addString(Contact.URL, Contact.ATTR_WORK, this.addressBookWebsite);}

 Is the Contact.ATTR_WORK necessary for entering a website?

 

It's just that addString must input a  field and attribute.

 

 

 

 

Developer
Posts: 30
Registered: ‎05-07-2009
My Device: Not Specified

Re: Adding a Note and a Website URL to a contact

Take a look at the javadocs for net.rim.blackberry.api.pdap.BlackBerryContact, which say which field support which attributes.  Only Contact.TEL and Contract.ADDR fields support the ATTR_WORK attributes, and therefore it is probably ignored when used in the Contact.URL field.  You can just use PIMItem.ATTR_NONE when adding the URL field; namely,

 

contact.addString(Contact.URL, PIMItem.ATTR_NONE, this.addressBookWebsite);

 

You don't need to worry about testing contact.isSupportedAttribute(Contact.URL, PIMItem.ATTR_NONE)