Lines Matching full:address
1 page.title=Displaying a Location Address
11 <li><a href="#fetch-address">Define an Intent Service to Fetch the
12 Address</a></li>
45 distance or displaying a map position, in many cases the address of the
47 they are or what is close by, a street address is more meaningful than the
51 location APIs, you can convert an address to the corresponding geographic
53 convert a geographic location to an address. The address lookup feature is
58 convert a geographic location to an address. The method returns an estimated
59 street address corresponding to a given latitude and longitude.</p>
64 address lookup feature. The lesson on
78 address, set the location permission in your app manifest to
89 <h2 id="fetch-address">Define an Intent Service to Fetch the Address</h2>
108 {@link android.app.IntentService}. This class is your address lookup service.
112 for conversion to an address, and a {@link android.os.ResultReceiver} object
113 to handle the results of the address lookup. The service uses a {@link
114 android.location.Geocoder} to fetch the address for the location, and sends
141 <p>The process of converting a geographic location to an address is called
153 address is localized to the user's geographic region.</p>
163 <h3 id="retrieve-street-address">Retrieve the street address data</h3>
165 <p>The next step is to retrieve the street address from the geocoder, handle
167 requested the address. To report the results of the geocoding
186 <p>To get a street address corresponding to a geographical location, call
190 address. The geocoder returns an array of addresses. If no addresses were
207 <li><strong>Sorry, no address found</strong> - The geocoder could not find an
208 address for the given latitude/longitude.</li>
211 <p>To get the individual lines of an address object, use the
212 {@link android.location.Address#getAddressLine getAddressLine()}
213 method provided by the {@link android.location.Address} class. Then join the
214 lines into a list of address fragments ready to return to the activity that
215 requested the address.</p>
219 <a href="#return-address">Return the address to the requestor</a>). The
222 the address. In the case of a failure, the string contains the error message,
236 List<Address> addresses = null;
242 // In this sample, get just a single address.
257 // Handle case where no address was found.
265 Address address = addresses.get(0);
268 // Fetch the address lines using {@code getAddressLine},
270 for(int i = 0; i < address.getMaxAddressLineIndex(); i++) {
271 addressFragments.add(address.getAddressLine(i));
281 <h3 id="return-address">Return the address to the requestor</h3>
283 <p>The final thing the intent service must do is send the address back to a
289 the address. In the case of a failure, the message contains some text
292 <p>You have already retrieved the address from the geocoder, trapped any errors
301 <a href="#retrieve-street-address">Retrieve the street address data</a>) and
321 background and is responsible for fetching the address corresponding to a
340 <li>A {@link android.os.ResultReceiver} to handle the results of the address
343 longitude that you want to convert to an address.</li>
366 user takes an action that requires a geocoding address lookup. For example,
367 the user may press a <em>Fetch address</em> button on your app's UI. Before
374 // Only start the service to fetch the address if GoogleApiClient is
381 // launch the service to fetch the address. As far as the user is
382 // concerned, pressing the Fetch Address button
383 // immediately kicks off the process of getting the address.
434 the address. In the case of a failure, the <code>resultData</code> contains
436 see <a href="#return-address">Return the address to the requestor</a>.</p>
455 // Display the address string
460 // Show a toast message if an address was found.