Kushal Shah
Kushal Shah

Reputation: 1333

Won't able to change the size of the array

I am trying to call the function on the click of the value selected in spinner(DropDownBox in java). As spinner take 1 value default it display the data but(It's fetching the data from the databsae) when i am selecting the other value the size of my array was the same as the value which selected default.The size of my array won't change.Any suggestion or help appreciated. Thanks in advance {This is my edited code]1

Upvotes: 0

Views: 286

Answers (2)

Michał Šrajer
Michał Šrajer

Reputation: 31182

Arrays are fixed size by definition. You probably want to use ArrayList<Type>().

See javadoc and this example.

BTW, looking at your code, I suggest you use String.split() instead of StringTokenizer. It's much simpler.

Upvotes: 2

JustCurious
JustCurious

Reputation: 1858

Array size cannot change! You can use ArrayList instead and then convert back to array if necessary

Upvotes: 2

Related Questions