May 2022
Intermediate to advanced
688 pages
20h 12m
English
Now that PhotoRepository supports searching, it is time to add a way for the user to enter a query and initiate a search. Do this by adding a SearchView.
As we said at the beginning of the chapter, SearchView is an action view, meaning your entire search interface can live in your application’s app bar.
Create a new menu XML file for PhotoGalleryFragment called res/menu/fragment_photo_gallery.xml. This file will specify the items that should appear in the app bar. (See Chapter 15 for detailed steps on adding the menu XML file if you need a reminder.)
Listing 21.6 Adding a menu XML file (res/menu/fragment_photo_gallery.xml)
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> ...Read now
Unlock full access