how to change android SearchView text

Khaled Annajar picture Khaled Annajar · Jan 20, 2013 · Viewed 50.4k times · Source

Is there a setText() method for SearchView or something like that? I try to set the search text in the searchView like this but there is no method for like this.

searchView.setText(searchToken);

Answer

Khaled Annajar picture Khaled Annajar · Jan 20, 2013

After wondering and trying I found out that there is a method in the API named setQuery() which you set the searchView text and you may choose to submit the search or not using the boolean parameter.

searchView.setQuery(searchToken, false);