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
New Developer
tdao
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.

 

Thanks,

--Thang Dao

Please use plain text.
Administrator
MSohm
Posts: 14,309
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
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.
Found a bug? Report it using Issue Tracker
Please use plain text.