Geocoding: Get Coordinates from an Address

In this first approach to getting location, the ContactMapActivity will take an entered address and look up and display the GPS coordinates of the address. This process is called geocoding. The first step is to create the layout in activity_contact_map.xml. For now, this layout will not use a map object. Refer to Figure 7.5 to code this layout. The exact layout is up to you—you’ve done all this before. However, to match to the code, use the following IDs for the widgets:

Get Coordinates Button–@+id/buttonGetLocation

Latitude output TextView–@+id/textLatitude

Longitude output TextView–@+id/textLongitude

Accuracy output TextView–@+id/textAccuracy

Figure 7.5 Initial Layout for getting location.

Obviously, ...

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.