Yes, that is much better than using Sqlite.
The Sub can take a List parameter and I can pass it an array, which gets converted to a List. This is the equivalent of passing the array by value to the Sub!
Now I can do something like:
Private MyArray(10) As Int = Array As Int(1,2,3,4,5,6,7,8,9,10)
TestList(MyArray)
Sub TestList(aList As List) 'The sub converts Array argument to List (by Value)
Log("Before")
Log("aList:"&aList)
Log("MyArray:"&ArrayToStr(MyArray))
aList.Set(1, aList.Get(1)*10) 'Changing the aList parameter no longer changes the MyArray(1) argument
Log("After")
Log("aList:"&aList)
Log("MyArray:"&ArrayToStr(MyArray))
End Sub
LOG:
Before
aList
ArrayList) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
MyArray:1 2 3 4 5 6 7 8 9 10
After
aList
ArrayList) [1, 20.0, 3, 4, 5, 6, 7, 8, 9, 10]
MyArray:1 2 3 4 5 6 7 8 9 10 <-- MyArray(1) no longer gets changed
This of course means the Sub() has to reference lists instead of an array which is fine if it is just my code. The code is less readable if I use Lists though.
But there are a lot of Android libraries that accept Arrays as parameters and not Lists like GradientDrawable.Initialize("TOP_BOTTOM", ColorArray). This means in these cases I will have to convert the List back to an array when necessary. Maybe I'll write a ListToIntArray() function for these cases.
I will have to decide whether to replace Arrays with Lists, or put up with the idiosyncrasies of Arrays.