0

Right now I currently am displaying the Latitude/Longitude within my Android Studio MapsActivity Marker by using the following:

 LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title(String.valueOf(latLng));
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE));

    currentLocationMarker = mMap.addMarker((markerOptions));

    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));

My goal is to display the entire address.

ADM
  • 20,406
  • 11
  • 52
  • 83
ttattini
  • 196
  • 1
  • 17
  • Possible duplicate of [How to get complete address from latitude and longitude?](https://stackoverflow.com/questions/9409195/how-to-get-complete-address-from-latitude-and-longitude) – ADM May 21 '18 at 16:14

1 Answers1

0

Use geocoder to get address from latlng

Geocoder geocoder; 
List<Address> addresses; 
geocoder = new Geocoder(this, Locale.getDefault()); 
addresses = geocoder.getFromLocation(latitude, longitude, 1); // Here 1 represent max location result to returned, by documents it recommended 1 to 5 
String address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
String city = addresses.get(0).getLocality();
Fazal Hussain
  • 1,129
  • 12
  • 28