Android Question Resizing Bidimensional Arrays

netkomm

Active Member
Licensed User
Longtime User
Hi guys,

let's say that I have a bidimensional array declared as a global (I cannot specify a size for during declaration because at that moment I don't know the exact size). It must be global so that it can be accessed throughout the whole module, how can I resize it within a sub?

The problem is that in a sub I am going to parse a XML file and only at that point I will know the size that the array is going to be, but if I do so, B4A throws an error

Compiling code. Error
Error compiling program.
Error description: Current declaration does not match previous one.
Previous: {Type=ImageView,Rank=1, RemoteObject=True}
Current: {Type=ImageView,Rank=2, RemoteObject=True}
Dim Images(10, 10) As ImageView


since it does not size/resize the array but rather (that's what I think) it tries to create an array that conflicts with the global one.

Is there a way that will allow me to specify the size of an array in a sub for an array declared as global?

Thanks!
 
Last edited:

klaus

Expert
Licensed User
Longtime User
How did you declare Images in Globals?
I supect that you declared it in globals like this:
Dim Images() As ImageView 'Rank1

In Globals:
Dim Images(,) As ImageView 'Rank2
And in the routine:
Dim Images(10, 10) As ImageView
 
Upvote 0
Top