to top
Android APIs
Added in API level 11
public static interface

SearchView.OnSuggestionListener

android.widget.SearchView.OnSuggestionListener

Class Overview

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

Summary

Public Methods

? Examples
abstract boolean onSuggestionClick(int position)
Called when a suggestion was clicked.

? Examples
abstract boolean onSuggestionSelect(int position)
Called when a suggestion was selected by navigating to it.

Public Methods

public abstract boolean onSuggestionClick (int position)

Added in API level 11

Called when a suggestion was clicked.

Parameters
position the absolute position of the clicked item in the list of suggestions.
Returns
  • 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.

public abstract boolean onSuggestionSelect (int position)

Added in API level 11

Called when a suggestion was selected by navigating to it.

Parameters
position the absolute position in the list of suggestions.
Returns
  • 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.
No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.