Lists are similar to dynamic arrays. You can add and remove items from a list and it will change its size accordingly. A list can hold any type of object. However if a list is declared as a process global object it cannot hold activity objects (like views). Basic4android automatically converts regular arrays to lists. So when a List parameter is expected you can pass an array instead. For example: DimList1AsList List1.Initialize List1.AddAll(ArrayAsInt(1, 2, 3, 4, 5)) Use the Get method to get an item from the list. Lists can be saved and loaded from files using File.WriteList and File.ReadList. You can use a For loop to iterate over all the values: Fori = 0ToList1.Size - 1 DimnumberAsInt number = List1.Get(i)
...
Next
A collection that holds pairs of keys and values. The keys are unique. Which means that if you add a key/value pair (entry) and the collection already holds an entry with the same key, the previous entry will be removed from the map. Fetching an item is done by looking for its key. This is usually a very fast operation (O(1) compared to O(n) in a list). The key should be a string or a number. The value can be any type of object. Note that this map implementation does return items in the same order as they were added. Usually you will use Put to add items and Get or GetDefault to get the values based on the key. If you need to iterate over all the items you can use a For loop like: ForEachKeyAsStringInMap.Keys DimValueAsObject = Map.Get(Key)
Next Similar to a list, a map can hold any object, however if it is a process global variable then it cannot hold activity objects (like views). Maps are very useful for storing applications settings. You can save and load maps with "simple values" with File.WriteMap and File.ReadMap. More complex maps can be saved with B4XSerializator.