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

New Developer
Posts: 3
Registered: ‎09-04-2008
My Device: Not Specified

Address book fields displaying "null"

Hi all,


I have a problem of a contact's fields displaying a word "null" instead of not showing it when using addStringArray(). 
The sample code is below:



BlackBerryContact contact = (BlackBerryContact) contactList.createContact();


String[] name = new String[5];

name[BlackBerryContact.NAME_GIVEN] = "test";

 //PREFIX and FAMILY fields are left as "null"


contact.addStringArray(BlackBerryContact.NAME, BlackBerryContact.ATTR_NONE, name);



In the address book application, instead of displaying only "test", it now shows "null test null".

The Addresses (Work / Home) also suffer this similar problem.

I'm testing on the Simulator 4.5.0, 8330 model. 


Please let me know what I need to do to fix this problem.



--Thang Dao

BlackBerry Development Advisor
Posts: 15,877
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Address book fields displaying "null"

It doesn't appear that you are initializing the other strings in your array.  Setting them to empty strings ("") should resolve the issue.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.