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, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access