4.5.9. shareSearch Method
Method shareSearch
(Fig. 4.26) is called by the event handler in Fig. 4.25 when the user selects to share a search. Lines 217–218 create a String
representing the search to share. Lines 221–227 create and configure an Intent
that allows the user to send the search URL using an Activity
that can handle the Intent.
ACTION_SEND (line 222).
213 // allows user to choose an app for sharing a saved search's URL214 private void shareSearch(String tag)215 {216 // create the URL representing the search217 String urlString = getString(R.string.searchURL) +218 Uri.encode(savedSearches.getString(tag, ""), "UTF-8");219 220 // create Intent to share urlString ...
Get Android™ How to Program, Second Edition 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.