I've been messing with B4J for about a week, so the following may be due to naivety.
With this code
I get the following. What am I missing?
With this code
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
Dim L1 As List
Dim L2 As List
End Sub
Sub AppStart (Args() As String)
L1.Initialize
L1.Add(1)
L1.Add(2)
L1.Add(3)
L1.Add(4)
Log(L1)
Log(L1.Size)
L1.RemoveAt(0)
Log(L1.Size)
L1.clear
Log(L1.Size)
Log("--")
L2.Initialize2(Array As Int(1,2,3,4))
Log(L2)
Log(L2.Size)
L2.RemoveAt(0)
Log(L2.Size)
L2.clear
Log(L2.Size)
End Sub
B4X:
Program started.
(ArrayList) [1, 2, 3, 4]
4
3
0
--
(ArrayList) [1, 2, 3, 4]
4
Error occurred on line: 31 (main).
java.lang.UnsupportedOperationException
at java.util.AbstractList.remove(AbstractList.java:161)
at anywheresoftware.b4a.objects.collections.List.RemoveAt(List.java:92)
at b4j.example.main._appstart(main.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:221)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.main(main.java:28)
Program terminated (StartMessageLoop was not called).