Lines Matching full:address
1 page.title=Displaying a Location Address
14 <li><a href="#DefineTask">Define the Address Lookup Task</a></li>
47 calculating distance or displaying a map position, in many cases the address of the location is
52 latitude and longitude values. This lesson shows you how to use this address lookup feature.
55 <strong>Note:</strong> Address lookup requires a backend service that is not included in the
67 Define the address lookup task
69 <h2 id="DefineTask">Define the Address Lookup Task</h2>
71 To get an address for a given latitude and longitude, call
78 While your app is getting the address, display an indeterminate activity
81 hierarchy. When you start the address lookup, you set its visibility to "visible".
98 {@link android.location.Geocoder#getFromLocation getFromLocation()} and returns an address.
100 address, and a {@link android.widget.ProgressBar} object that allows you to control the
113 mAddress = (TextView) findViewById(R.id.address);
124 * String - An address passed to onPostExecute()
136 * look up the address, and return it
139 * @return A string containing the address of the current
140 * location, or an empty string if no address can be found,
149 // Create a list to contain the result address
150 List<Address> addresses = null;
153 * Return 1 address.
161 return ("IO Exception trying to get address");
168 " passed to address service";
173 // If the reverse geocode returned an address
175 // Get the first address
176 Address address = addresses.get(0);
178 * Format the first line of address (if available),
183 // If there's a street address, add it
184 address.getMaxAddressLineIndex() > 0 ?
185 address.getAddressLine(0) : "",
187 address.getLocality(),
188 // The country of the address
189 address.getCountryName());
193 return "No address found";
202 The next section shows you how to display the address in the user interface.
204 <!-- Define a method to display the address -->
207 {@link android.os.AsyncTask#doInBackground doInBackground()} returns the result of the address
221 * the text of the UI element that shows the address. If the
225 protected void onPostExecute(String address) {
229 mAddress.setText(address);
235 The final step is to run the address lookup.
237 <!-- Get and display the address -->
240 To get the address, call {@link android.os.AsyncTask#execute execute()}. For example, the
241 following snippet starts the address lookup when the user clicks the "Get Address" button:
247 * The "Get Address" button in the UI is defined with
267 * onPostExecute() displays the address.