Updating ViewFragment
Now, let's move on to ViewFragment
. We will be using an Intent
class to launch the built-in Google Maps app but with a pin to mark the location the photo was taken at.
The GPS location is already in the Photo
object and we just need to do the following:
- Capture the latitude and longitude in
Double
variables - Build a String from these values that will represent the URI that we need to create the
Intent
object - Create the
Intent
class - Start a Google Maps
Activity
passing in theIntent
class
Of course, all this takes place inside the class that handles the button clicks for SHOW MAP.
Add the highlighted code that we just discussed to handle what happens when the user clicks on the SHOW MAP button:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_view, container, false); TextView textView = (TextView) view.findViewById(R.id.textView); Button buttonShowLocation = (Button...