The Search Dialog
In this section, you will implement Android’s search interface in PhotoGallery. You will start with the old style dialog interface.
Creating a search interface
In Honeycomb, the Android folks got rid of hardware search buttons. Even before that, though, there was no guarantee of having a search button. Modern Android apps that rely on search must always have a search button somewhere in the app if they are targeting pre-3.0 devices.
Implementing this is not difficult. Simply call Activity.onSearchRequested(). This method performs the exact same operation as pressing the search button.
Add a menu XML file for PhotoGallery in res/menu/fragment_photo_gallery.xml. Your app will also need an interface to clear the search query, ...
Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.