Android Question Set focus in ACSearchView from button

Discussion in 'Android Questions' started by kris A, Jun 13, 2019.

  1. kris A

    kris A Member Licensed User

    Hi all,
    i want to set focus in ACSearchView from button click,
    is there any idea?

  2. Brandsum

    Brandsum Well-Known Member Licensed User

    Try this (Not tested)
    Dim r As Reflector
    r.Target = SearchBar
    r.Target = r.GetField(
    Dim t As EditText = r.RunMethod4("findViewById"Array As Object(r.GetStaticField("" & ".R$" & "id""search_src_text")), Array As String(""))
  3. kris A

    kris A Member Licensed User

    Hi brandsum,
    thanks for the help,
    I've tried your code but nothing happen
    Here my code,
    Dim sv As ACSearchView
    Dim si As ACMenuItem
    Dim btnSearch As Button

    Sub Activity_CreateMenu(Menu As ACMenu)
    "Search", sv.THEME_DARK)
        sv.IconifiedByDefault = 
    Dim xml As XmlLayoutBuilder
        si = 
    Menu.Add2(11"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.
    Last edited: Jun 13, 2019
  4. kris A

    kris A Member Licensed User

    case close, ty brandsum for your time
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice