Skip to content

Most visited

Recently visited

navigation
added in version 25.1.0
belongs to Maven artifact com.android.support:appcompat-v7:27.0.0

SearchView.OnSuggestionListener

public static interface SearchView.OnSuggestionListener

android.support.v7.widget.SearchView.OnSuggestionListener


Callback interface for selection events on suggestions. These callbacks are only relevant when a SearchableInfo has been specified by setSearchableInfo(SearchableInfo).

Summary

Public methods

abstract boolean onSuggestionClick(int position)

Called when a suggestion was clicked.

abstract boolean onSuggestionSelect(int position)

Called when a suggestion was selected by navigating to it.

Public methods

onSuggestionClick

added in version 25.1.0
boolean onSuggestionClick (int position)

Called when a suggestion was clicked.

Parameters
position int: the absolute position of the clicked item in the list of suggestions.

Returns
boolean true if the listener handles the event and wants to override the default behavior of launching any intent or submitting a search query specified on that item. Return false otherwise.

onSuggestionSelect

added in version 25.1.0
boolean onSuggestionSelect (int position)

Called when a suggestion was selected by navigating to it.

Parameters
position int: the absolute position in the list of suggestions.

Returns
boolean true if the listener handles the event and wants to override the default behavior of possibly rewriting the query based on the selected item, false otherwise.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)