I am new to Basic4Android (I am more of a C / C++ guy) so I figure I am just doing something silly here.
I am having trouble with arrays in a code module I have created. I define an array of double in the Process_Globals sub
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals:
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim tTokenType(25) As Int
Dim pTokenList(25) As Double
End Sub
Then I have a sub routine Init that I call to set things up in the module which I call from the main module:
Sub Init
Dim i As Int
For i = 0 To 24
pTokenList(i)=0.0
tTokenType(i) = 0
Next
End Sub
During debug, the program stops at pTokenList(i)=0.0 and I can see in the debugger under local variables, the error is LastException java.lang.NullPointerException
and under global variables, both tTokenType and pTokenList are null.
All non-array variables work as expected in the code module.
I have tried Dim pTokenList() as double in Process_Globals and then "re" dimming in init as a 25 piece array, but that just creates it as a localvariable.
I have also tried the same under Process_Globals without success.
Can someone point me in the right direction? Thanks in advance
I am having trouble with arrays in a code module I have created. I define an array of double in the Process_Globals sub
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals:
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim tTokenType(25) As Int
Dim pTokenList(25) As Double
End Sub
Then I have a sub routine Init that I call to set things up in the module which I call from the main module:
Sub Init
Dim i As Int
For i = 0 To 24
pTokenList(i)=0.0
tTokenType(i) = 0
Next
End Sub
During debug, the program stops at pTokenList(i)=0.0 and I can see in the debugger under local variables, the error is LastException java.lang.NullPointerException
and under global variables, both tTokenType and pTokenList are null.
All non-array variables work as expected in the code module.
I have tried Dim pTokenList() as double in Process_Globals and then "re" dimming in init as a 25 piece array, but that just creates it as a localvariable.
I have also tried the same under Process_Globals without success.
Can someone point me in the right direction? Thanks in advance