Sorry,an error was triggered referring to the above method
my codes:
Type QueueType(Head As Byte , Tail As Byte , _
Size As Byte, Buff(100) As Byte)
Type MyType(CustomerNO As String, _
Buffer(100) As Byte, _
BufferIndex As Byte, _
SetFlag As Boolean, _
ZoneAlarm(12) As Boolean, _
PSW(8) As Byte, _
ControlFlag As Boolean, _
LastTSN As Byte , _
LastRSN As Byte , _
SerialNo As Byte , _
Retry As Int, _
RMCQue As QueueType)
Dim DL As MyType
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
If FirstTime = True Then
Activity.LoadLayout("Main")
txtIP.Text =MyIP
txtPort.Text =MyPort
InitializeQue(DL.RMCQue) ' ← this line call sub InitializeQue
LoadConst2Array
End If
End Sub
Sub InitializeQue(Q As QueueType)'初始化
Q.Head = 0 '← had error when run to this line
Q.Tail = 0
Q.Size = 100
End Sub
==========================================================
error description:
LogCat connected to: 0123456789ABCDEFG
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **
Error occurred on line: 210 (main)
java.lang.NullPointerException: expected receiver of type b4a.example.main$_queuetype, but got null
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:680)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:308)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at b4a.example.main.afterFirstLayout(main.java:100)
at b4a.example.main.access$100(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:78)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5297)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)