My eventual usage calls for an array of class instances, so this function returns an array...
In the mechanics of it the orders are first created with a List because it is dynamic, so I can add items to the List as they are discovered. Once the List is built I coerce the List to an array (because that's what is needed downstream)...
I then eventually pass it to a routine that will utilize the array....
Where it says "orders.Length" I get a runtime error: java.lang.RuntimeException: Field; length not found in java.util.ArrayList. So I tried changing the reference to orders.Size at the FOR loop, but now it won't compile:
I seem to have put myself into a pickle, and it's not really clear to me why this approach does not work.
B4X:
Sub DeliveredOrders As SerializableOpenOrder()
In the mechanics of it the orders are first created with a List because it is dynamic, so I can add items to the List as they are discovered. Once the List is built I coerce the List to an array (because that's what is needed downstream)...
B4X:
Dim orders(reclsth.Size) As SerializableOpenOrder
For i = 0 To reclsth.Size-1
orders(i) = reclsth.Get(i)
Next
Return orders
I then eventually pass it to a routine that will utilize the array....
B4X:
Public Sub DeleteOrders( orders() As SerializableOpenOrder )
Dim soo As SerializableOpenOrder
Dim ooh As OpenOrderHeader
Dim ool As OpenOrderLine
For i = 0 To orders.Length - 1
Where it says "orders.Length" I get a runtime error: java.lang.RuntimeException: Field; length not found in java.util.ArrayList. So I tried changing the reference to orders.Size at the FOR loop, but now it won't compile:
B4X:
Error compiling program.
Error description: Only 'Length' is supported by arrays.
I seem to have put myself into a pickle, and it's not really clear to me why this approach does not work.