4.5.10. deleteSearch Method
The event handler in Fig. 4.25 calls method deleteSearch (Figure 4.27) when the user long presses a search tag and selects Delete. Before deleting the search, the app displays an AlertDialog to confirm the delete operation. Lines 241–242 set the dialog’s title to a formatted String in which tag replaces the format specifier in the String resource R.string.confirmMessage ("Are you sure you want to delete the search \"%s\"?"). Lines 245–254 configure the dialog’s negative button to dismiss the dialog. The String resource R.string.cancel represents "Cancel". Lines 257–275 configure the dialog’s positive button to remove the search. The String resource R.string.delete represents "Delete". Line 263 removes the tag from ...
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