vlast3k
vlast3k

Reputation: 78

Android - Query Text in Search view is not rewritten after suggestion selected

I am trying to implement a SuggestionProvider for my App. I've made it running, but the issue I face is that after clicking on a suggestion - it's value is not replaced in the Query Text above. Basically - clicking on it - does what is expected, but afterwards - the text in the search view remains the same as what was written by the user, and not what was selected from the suggestion.

in my Search Configuration i have android:searchMode="queryRewriteFromText", and in my SearchProvider i utilize SearchManager.SUGGEST_COLUMN_QUERY, and set it to the same value as the value of the Search Suggestion.

Do I need to do something special to get it updated after the click ?

Upvotes: 3

Views: 679

Answers (1)

Ognjen Stanić
Ognjen Stanić

Reputation: 535

Well, now is probably late, but maybe can help someone. Whatever intent you get, you can grab query like this:

if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
  String query = intent.getStringExtra(SearchManager.QUERY);
  mSearchView.setQueryText(query, false);
} else if (Intent.ACTION_VIEW.equals(namera.getAction())) {
  String query = intent.getStringExtra(SearchManager.QUERY);
  mSearchView.setQuery(query, false);
}

Upvotes: 2

Related Questions