to top
Android APIs
public class

SearchViewCompat

extends Object
java.lang.Object
   ↳ android.support.v4.widget.SearchViewCompat

Class Overview

Helper for accessing features in SearchView introduced after API level 4 in a backwards compatible fashion.

Summary

Nested Classes
class SearchViewCompat.OnQueryTextListenerCompat Callbacks for changes to the query text. 
Public Methods
static View newSearchView(Context context)
Creates a new SearchView.
static void setOnQueryTextListener(View searchView, SearchViewCompat.OnQueryTextListenerCompat listener)
Sets a listener for user actions within the SearchView.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static View newSearchView (Context context)

Creates a new SearchView.

Parameters
context The Context the view is running in.
Returns
  • A SearchView instance if the class is present on the current platform, null otherwise.

public static void setOnQueryTextListener (View searchView, SearchViewCompat.OnQueryTextListenerCompat listener)

Sets a listener for user actions within the SearchView.

Parameters
searchView The SearchView in which to register the listener.
listener the listener object that receives callbacks when the user performs actions in the SearchView such as clicking on buttons or typing a query.