Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setSearchText don't start search #303

Open
PaolinoAngeletti opened this issue Mar 8, 2018 · 1 comment
Open

setSearchText don't start search #303

PaolinoAngeletti opened this issue Mar 8, 2018 · 1 comment

Comments

@PaolinoAngeletti
Copy link

If I try to set programmatically the text with setSearchText method, the search don't start and suggestions aren't showed.
It'a bug or setSearchText isn't the right way?

@kkl260
Copy link

kkl260 commented Apr 29, 2020

I know this is old, but I had the same issue so I wanted to leave a response on how I fixed this in case anyone else comes by this issue.

I had the same issue when doing the voice search. I would voice search and setSearchText with my results, but it didn't do the search. So I pressed the enter button programmatically. Here is my code in Kotlin:

            Thread(Runnable {
                try {
                    val inst = Instrumentation()
                    inst.sendKeyDownUpSync(KeyEvent.KEYCODE_ENTER)
                } catch (e: InterruptedException) {
                }
            }).start()

This will press the enter button for you, starting the search. Obviously your search view would have to be in focus, setSearchText() should do that anyways, but if it doesn't you can add : search_view.setSearchFocused(true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants