Search is a core user feature on Android. Users should be able to search any data that is available to them, whether the content is located on the device or the Internet. To help create a consistent search experience for users, Android provides a search framework that helps you implement search for your application.
The search framework offers two modes of search input: a search dialog at the top of the screen or a search widget (SearchView) that you can embed in your activity layout. In either case, the Android system will assist your search implementation by delivering search queries to a specific activity that performs searchs. You can also enable either the search dialog or widget to provide search suggestions as the user types. Figure 1 shows an example of the search dialog with optional search suggestions.
Once you've set up either the search dialog or the search widget, you can:
- Enable voice search
- Provide search suggestions based on recent user queries
- Provide custom search suggestions that match actual results in your application data
- Offer your application's search suggestions in the system-wide Quick Search Box
The following documents show you how to use Android's framework to implement search:
Creating a Search Interface:
How to set up your application to use the search dialog or search widget.
Adding Recent Query Suggestions:
How to provide suggestions based on queries previously used.
Adding Custom Suggestions:
How to provide suggestions based on custom data from your application and also offer them in the system-wide Quick Search Box.
Searchable Configuration:
A reference document for the searchable configuration file (though the other documents also discuss the configuration file in terms of specific behaviors).