Android Question Use of Array

AHilberink

Active Member
Licensed User
Longtime User
Hi,

I think this will be a simple basic question, but as a beginner I was not able to solve.

I need an array, but I don't know how much will be in it.

Using:
DIM arr() As String

will give the error:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0

DIM arr(5) As String
works fine, but for only the first 5 and as already mentioned I don't know how much will be in it.

Other option I tried was:
DIM arr As List

but arr.Add expect an List Object, not a string.

What can I use best and how (short example will be very welcome :))

André
 

AHilberink

Active Member
Licensed User
Longtime User
Hi Erel,

Thanks for the answer. I will use List. I just discover the problem adding a string. I forgot to Initialize the list before use. Stupid of me!!

Now it works fine.

André
 
Upvote 0
Top