Displaying Your Contacts’ Locations

Now that you can find your device’s location and display the real-time location on the map, it’s time to show your contacts’ locations on the map. The map can be accessed from any of the three other activities through the navigation bar. If the user accesses the map from either the contact list or the settings activities, the map should display all the contacts in the database on the map. If the user accesses the map from the contact activity, the map should display only that contact. Implementing the second display type requires coding the ContactActivity to pass the current contact’s ID to the map.

Open ContactActivity.java and locate the initMapButton method. This method is modified to pass the contact’s ...

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android 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.