Android Question Solved: Map to AutoCompleteEditText?

anOparator

Active Member
Licensed User
Longtime User
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:
B4X:
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?

B4X:
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:
B4X:
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
 
Top