B4J Question Loading Map collection keys in to a ComboBox

knutf

Active Member
Licensed User
Longtime User
This code cause a exception:
B4X:
    Dim itms As Map = CreateMap("item1":"value1","item2":"value2","item3":"value3")
    ComboBox1.Items.AddAll(itms.Keys)

java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.Map$IterableMap cannot be cast to java.util.List

Is this the best solution?:
B4X:
    Dim itms As Map = CreateMap("item1":"value1","item2":"value2","item3":"value3")
    For Each key In itms.Keys
        ComboBox1.Items.Add(key)
    Next
 
Top