AutoCompleteEditText - get results

Shay

Well-Known Member
Licensed User
Longtime User
Hi

is there a way to get current results?
meaning if my list is aa, ab, ac, ba, bb
and I type "a" I wish to get the "aa,ab,ac" into some list
for further manipulation
 

admac231

Active Member
Licensed User
Longtime User
There is no official implemented way for it as far as I can see.

Here's a bit of code that does the trick though:

B4X:
Sub autoCompleteEditText1_TextChanged (Old As String, New As String)
   If New = "" Then
      Return
   End If
   
   tmpList.Clear
   Dim tmpStr As String
   For i = 0 To originalList.Size - 1
      tmpStr = originalList.Get(i) 
      If tmpStr.ToLowerCase.StartsWith(New.ToLowerCase) Then
         tmpList.Add(originalList.Get(i))
      End If
   Next
End Sub

Where originalList is the list you used for "SetItems" for the AutoCompleteEditText and tmpList is the list containing the currently displayed items.
 
Upvote 0
Top