All the conversion between these are driving me nuts. In a code module I had no problem, but in a library they are giving me issues. I have a library with a custom label (I'm Making my own Combobox/Spinner) holding an Item list (A B4A List to make it simplest). I always make sure the List is initialized even if empty. If I pass in a Null List it handles it properly and if I pass an Array as String() it works too. All my error checking checks for List being passed in to be initialized and when I show the List it checks size of the list or doesn't show it.
The problem seems to be with File.ReadList and possibly variable scope or something. Currently I fill the list in the library with Initialize2 in the List. I have log messages where I output the size of the passed in list- My file read with File.ReadList is US States and it reports 50. When the label is tapped it shows the list: My Array as String() shows its list, my Null List shows no list, and my File.ReadList Force Closes the application.
It is like it sees the list size still, but there is no list. I always thought that even when a local is out of scope it still exists since something else is referencing it. Behind the scenes the Array as String() is making a List and it remains and works fine. The documentation says that initialize2 shares lists, so I tried doing a Clear and AddAll then, but not only did it still fail with the File.ReadList it also now failed with the Array as String(). So I guess the Array doesn't convert right that way.
Is there something File.ReadList does when going out of Scope in B4A that handles the List it created differently? I used this same way in a Code Module and it works fine, but it is like B4A isn't seeing the List being used by the library and killing it.
The problem seems to be with File.ReadList and possibly variable scope or something. Currently I fill the list in the library with Initialize2 in the List. I have log messages where I output the size of the passed in list- My file read with File.ReadList is US States and it reports 50. When the label is tapped it shows the list: My Array as String() shows its list, my Null List shows no list, and my File.ReadList Force Closes the application.
It is like it sees the list size still, but there is no list. I always thought that even when a local is out of scope it still exists since something else is referencing it. Behind the scenes the Array as String() is making a List and it remains and works fine. The documentation says that initialize2 shares lists, so I tried doing a Clear and AddAll then, but not only did it still fail with the File.ReadList it also now failed with the Array as String(). So I guess the Array doesn't convert right that way.
Is there something File.ReadList does when going out of Scope in B4A that handles the List it created differently? I used this same way in a Code Module and it works fine, but it is like B4A isn't seeing the List being used by the library and killing it.