O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required