Code example for Geocoder

Methods: getFromLocation, toString

0
 
		public String getAddress(final Location pLocation) {
			List<Address> add = null;
 
			try { 
				add = mGeocoder.getFromLocation(pLocation.getLatitude(), pLocation.getLongitude(), 1);
				Log.e("@MSLLocationManager", "add equals" + add.toString());
			} catch (final IOException e) {
				Log.e("@MSLLocationManager", "CRASHING INSIDE MSLLocationManager.getAddress() TRY/CATCH");
				Log.e("@MSLLocationManager", "pLocation equals " + pLocation.toString());
				Log.e("@MSLLocationManager", "mGeocoder equals "  + mGeocoder.toString());
				e.printStackTrace();
				Log.e("@MSLLocationManager", "DYING NOW");
			} 
 
			Log.e("@MSLLocationManager", "DEAD NOW");
			Log.e("@MSLLocationManager", "DEATH'S ADDRESS IS " + add.toString());
			final String line1 = add.get(0).getAddressLine(0);
			final String line2 = add.get(0).getAddressLine(1);
 
			final String address = line1 + "\n " + line2;