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
duksunkim
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified
Accepted Solution

CheckBoxField []

Hello,

 

I have a question for using CheckBoxField.

When I use CheckBoxField as below it works fine:

============================== 

for (int cnt=0; cnt < listOfBusiness.length ; cnt++ )

 {

 System.out.println("Adding CheckboxField for - " + listOfBusiness[cnt] );

 rows.add(new CheckboxField(listOfBusiness[cnt], true));

 

 }

==============================

But when I use as below it does not work.

CheckBoxField [] chkBoxField; 

for (int cnt=0; cnt < listOfBusiness.length ; cnt++ )

 {

   chkBoxField[cnt] = new CheckboxField(listOfBusiness[cnt], true);

  rows.add(chkBoxField[cnt]);

 //rows.add(new CheckboxField(listOfBusiness[cnt], true));

 

 }

 

Can you please tell me what wrong is?

 

 

Please use plain text.
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: CheckBoxField []

[ Edited ]

You have to initialize the array.

 

CheckBoxField[] chkBoxField =  new CheckBoxField[listOfBusiness.length];

Message Edited by mreed on 08-22-2008 12:13 AM
Please use plain text.
Developer
duksunkim
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified

Re: CheckBoxField []

Oops! Thanks you.
Please use plain text.