January 2014
Intermediate to advanced
736 pages
70h 43m
English
The event handler in Fig. 4.21 calls MainActivity method addTaggedSearch (Fig. 4.23) to add a new search to savedSearches or to modify an existing search.
111 // add new search to the save file, then refresh all Buttons112 private void addTaggedSearch(String query, String tag)113 {114 // get a SharedPreferences.Editor to store new tag/query pair 115 SharedPreferences.Editor preferencesEditor = savedSearches.edit();116 preferencesEditor.putString(tag, query); // store current search 117 preferencesEditor.apply(); // store the updated preferences 118 119 // if tag is new, add to and sort tags, then display updated list ...
Read now
Unlock full access