Dim r As Reflector
r.Target = SearchBar
r.Target = r.GetField("mSearchView")
Dim t As EditText = r.RunMethod4("findViewById", Array As Object(r.GetStaticField("android.support.v7.appcompat" & ".R$" & "id", "search_src_text")), Array As String("java.lang.int"))
t.RequestFocus
Dim r As Reflector
r.Target = SearchBar
r.Target = r.GetField("mSearchView")
Dim t As EditText = r.RunMethod4("findViewById", Array As Object(r.GetStaticField("android.support.v7.appcompat" & ".R$" & "id", "search_src_text")), Array As String("java.lang.int"))
t.RequestFocus
Hi brandsum,
thanks for the help,
I've tried your code but nothing happen
Here my code,
B4X:
Dim sv As ACSearchView
Dim si As ACMenuItem
Dim btnSearch As Button
Sub Activity_CreateMenu(Menu As ACMenu)
sv.Initialize2("Search", sv.THEME_DARK)
sv.IconifiedByDefault = True
Menu.Clear
Dim xml As XmlLayoutBuilder
si = Menu.Add2(1, 1, "productSearch", xml.GetDrawable("ic_search_white_24dp"))
si.SearchView = sv
End Sub
Sub btnSearch_Click
End Sub
i wanna give sv a focus (without si clicked), when user click btnSearch
thanks before.