Android Question Problem with Type inside of Type

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I did this:

Sub Process_Globals
Type sGameFrame(sGF_Score As Int, sGF_Frame As Int, sGF_Count As Int, sGF_1stBallPinsLeft As Int, sGF_2ndBallPinsLeft As Int)
Type sGameInfo(G_CurrentFrame As Int, G_SecondBall As Boolean, G_PinsSelected As Int,G_GameFrames(12) As sGameFrame)

Dim G_GameInfo As sGameInfo
End Sub

Sub GameStart
Dim I As Int

G_GameInfo.G_CurrentFrame = 1
G_GameInfo.G_PinsSelected = 0
G_GameInfo.G_SecondBall = False

For I = 0 To 11
G_GameInfo.G_GameFrames(I).sGF_Score = 0
G_GameInfo.G_GameFrames(I).sGF_Frame = 0
G_GameInfo.G_GameFrames(I).sGF_Count = 0
G_GameInfo.G_GameFrames(I).sGF_1stBallPinsLeft = 0
G_GameInfo.G_GameFrames(I).sGF_2ndBallPinsLeft = 0
Next

End Sub

Now none of the above got any complaints from the compiler

But on the first entry into the For Loop I get this when trying to do Line 83: G_GameInfo.G_GameFrames(I).sGF_Score = 0


Error occurred on line: 83 (game)

gameafterFirstLayout (java line: 98)
java.lang.NullPointerException
at java.lang.reflect.Array.get(Array.java:96)
at anywheresoftware.b4a.shell.ArraysUtils.getElement(ArraysUtils.java:76)
at anywheresoftware.b4a.shell.Shell.getArrayElement(Shell.java:350)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:261)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
...

ameafterFirstLayout (java line: 98)
java.lang.OutOfMemoryError
at anywheresoftware.b4a.shell.ShellConnector.readObject(ShellConnector.java:275)
at anywheresoftware.b4a.shell.ShellConnector.readList(ShellConnector.java:220)
at anywheresoftware.b4a.shell.Shell.fillHtSubs(Shell.java:361)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:250)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
...


NOW I assume this is all happening because I have an Array defined inside of a Type. So how do I define an array inside of a Type inside of another Type? Or is this not possible?

Thanks

BobVal
 
Top