Android Question Pass the Value of the SearchView to an EditText

Lyndon Bermoy

Active Member
Licensed 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: http://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

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

Lyndon Bermoy

Active Member
Licensed 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.
 
Top