anOparator Active Member Licensed User Longtime User Feb 26, 2017 #1 I just noticed AutoCompleteEditText, it does everything I was trying to do with EditText. I only want to check for prefixes. Unless SearchView works better with maps then SearchView is it. I’ve only found examples of AutoCompleteEditText used with arrays: Code: Sub Activity_Create(FirstTime As Boolean) ACT.Initialize("ACT") Activity.AddView(ACT, 10dip, 10dip, 500dip, 80dip) Dim people() As String people = Array As String("Alan", "Albert", "Amanda", "Andorra") ACT.SetItems(people) End Sub How does AutoCompleteEditText use a Map? Code: Sub Activity_Create(FirstTime As Boolean) ACT.Initialize("ACT") Activity.AddView(ACT, 10dip, 10dip, 500dip, 80dip) Dim mapPerson As Map = CreateMap("name": "Alan", "age": 1, "photo":"grapher") ACT.SetItems(mapPerson.Keys) ‘ACT.SetItems(mapPerson.Keys) End Sub And do an: Code: Sub ACT_ItemClick (value As Int) ' Used with a Map, must fix Dim Map1 As Map = CreateMap("alan": 0, "robert": 1, "tony": 2) Dim value As Int = Map1.GetDefault(ACT.Text, 0) ' Map1.GetDefault(ACT.Text, 0) Label1.Color = Colors.Gray End Sub Thanks in advance
I just noticed AutoCompleteEditText, it does everything I was trying to do with EditText. I only want to check for prefixes. Unless SearchView works better with maps then SearchView is it. I’ve only found examples of AutoCompleteEditText used with arrays: Code: Sub Activity_Create(FirstTime As Boolean) ACT.Initialize("ACT") Activity.AddView(ACT, 10dip, 10dip, 500dip, 80dip) Dim people() As String people = Array As String("Alan", "Albert", "Amanda", "Andorra") ACT.SetItems(people) End Sub How does AutoCompleteEditText use a Map? Code: Sub Activity_Create(FirstTime As Boolean) ACT.Initialize("ACT") Activity.AddView(ACT, 10dip, 10dip, 500dip, 80dip) Dim mapPerson As Map = CreateMap("name": "Alan", "age": 1, "photo":"grapher") ACT.SetItems(mapPerson.Keys) ‘ACT.SetItems(mapPerson.Keys) End Sub And do an: Code: Sub ACT_ItemClick (value As Int) ' Used with a Map, must fix Dim Map1 As Map = CreateMap("alan": 0, "robert": 1, "tony": 2) Dim value As Int = Map1.GetDefault(ACT.Text, 0) ' Map1.GetDefault(ACT.Text, 0) Label1.Color = Colors.Gray End Sub Thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Feb 27, 2017 #2 It should be simple to modify SearchView and make it match based on prefix only. AutoCompleteEditText expects a list of strings, not a map. Upvote 0
It should be simple to modify SearchView and make it match based on prefix only. AutoCompleteEditText expects a list of strings, not a map.