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
spring_suvarna
Posts: 330
Registered: ‎02-25-2009
My Device: Not Specified
Accepted Solution

ArrayList

Hello,

 

In .net we have ArrayList class , which can be used for creating array, clear the contents , add elements.

 

Do we have some think like this in blackberry jaa??

 

i tried using Arrays class, but its giving me error

 

 

public static Arrays aInfoserverlist = new Arrays();

this gives me error as

"Arrays() has private access in net.rim.device.api.util.Arrays"

 

I need to create array , which will accept strings , clear it , add new one , copy to another array

 

any solution??

 

Thanks in advance !

 

 

 

 

 

Please use plain text.
Developer
saravanaboopati
Posts: 147
Registered: ‎09-10-2008
My Device: Not Specified

Re: ArrayList

[ Edited ]

Try using Vectors instead of arrays.

 

Sample Code will give some idea similar to array functionality:

 

import java.util.Vector;

 

Vector SSV1 = new Vector();

 

//To Add Elements

SSV1.addElement("Name of the string");

 

//To set / Modify Elements at Specified index

SSV1.setElementAt(Temp1, IndexID);

 

//To Remove the particular Elements

SSV1.remove(index)

 

 

Message Edited by saravanaboopati on 03-30-2009 06:13 AM
Please use plain text.
Developer
spring_suvarna
Posts: 330
Registered: ‎02-25-2009
My Device: Not Specified

Re: ArrayList

hey thanks .. it worked
Please use plain text.
New Contributor
pralabhjain
Posts: 2
Registered: ‎11-13-2011
My Device: 8520
My Carrier: Airtel

Re: ArrayList

What will we do for GENERIC ARRAY LIST?

Please use plain text.
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: ArrayList

public ByteVector cpu_config = new ByteVector();

 

public void setConfigInt(char key, int value) {

//ByteVector method
cpu_config.addElement((byte) key);
byte[] arr = Util.itob(value);
cpu_config.addElement((arr[0]));
cpu_config.addElement((arr[1]));
cpu_config.addElement((arr[2]));
cpu_config.addElement((arr[3]));

}

-Fight with BB10
Please use plain text.