Code example for Geocoder

Methods: getFromLocation

0
	private class GeocoderTask extends AsyncTask<Location, Long, String> {
		@Override 
		protected String doInBackground(Location... params) {
			final Location location = params[0];
			final Geocoder geocoder = new Geocoder(getContext(), Locale.getDefault());
			try { 
				final List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
				if (addresses.size() > 0){
					final Address thisLocation = addresses.get(0);
					// TODO fixme 
					return thisLocation.toString();
					//return AddressUtils.addressToName(thisLocation); 
				} 
			} catch (final IOException e) {
				e.printStackTrace();
 
			} 
			return null; 
		} 
 
		@Override