Android Question Pass the Value of the SearchView to an EditText

Lyndon Bermoy

Active Member
Licensed User
Longtime User
Hi everyone, i would like to ask if how can i pass the value of the SearchView to an EditText. I mean is there a way that the EditText can hold the value from the searchView?

This is the link of the searchview library: https://www.b4x.com/android/forum/threads/class-searchview-more-powerful-alternative-to-autocompleteedittext.19379/

But I can't find it.

Here's my code but it doesn't display the SearchView to my EditText.

B4X:
Sub Activity_Create(FirstTime As Boolean)
  Activity.LoadLayout("layout1")
   sv.Initialize(Me, "sv")
  
  
   If FirstTime Then
     Dim cities As List
     cities = File.ReadList(File.DirAssets, "Cities.txt")
     'As an optimization we store the index as a process global variable
     'and only build it once.
     index = sv.SetItems(cities)
  
   Else
     sv.SetIndex(index)
    
   End If
     EditText1.text= sv
  
End Sub
 

Mahares

Expert
Licensed User
Longtime User
B4X:
Sub sv_ItemClick(Value As String)
    Msgbox("Chosen value: " & Value, "")
    Edittext1.Text=Value  
End Sub
 
Upvote 0

Lyndon Bermoy

Active Member
Licensed User
Longtime User
B4X:
Sub sv_ItemClick(Value As String)
    Msgbox("Chosen value: " & Value, "")
    Edittext1.Text=Value 
End Sub

I mean, the SearchView will be my edittext (The list will be on the edittext) not when I choose the value of the listview and then pass the chosen item on the edittext.
 
Upvote 0
Top