Open PaolinoAngeletti opened 6 years ago
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)
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?