Search code examples
androidsearchview

how to change android SearchView text


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);

Solution

  • 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);