The Easy Way: Implicit Intents
You will browse to this URL first by using your old friend the implicit intent. This intent will start up the browser with your photo URL.
The first step here is to make your app listen to presses on GridView items. This is another place where your code will look slightly different from your code in Chapter 9, since there is no matching GridFragment. Instead of overriding the onListItemClick(…) method in your fragment, you will hook it up more like a button click listener by calling the setOnItemClickListener(…) method on your GridView.
After doing that, it is a simple matter of creating and firing an implicit intent. Add the following code to PhotoGalleryFragment:
Listing 31.3 Web browsing with implicit intents ...
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