Displaying GPS Data in Google Maps

Now that you can display the trips that belong to a route, you want to display the appropriate trip inside Google Maps. First, you need to extend TripsActivity so that when users select a trip, the MapsActivity is displayed.

1. Open the TripsActivity class in the com.androiddevbook.onyourbike.chapter7.activities package. Override the method named onListItemClick. The easy way to do this is to right-click Source > Override > Implement Methods, check the onListItemClick method, and click OK:

    @Override    protected void onListItemClick(ListView listView, View view,            int position, long id) {}

2. Inside the onListItemClick method, obtain the selected trip and call the parent ...

Get Learning Android™ Application Programming: A Hands-On Guide to Building Android Applications 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.