Advertisement
kiev_north

function_get_address

Dec 30th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. private fun getAddressWithLocation() {
  2. this.latitude = latitude
  3. this.longitude = longitude
  4. var resultAddress = ""
  5. Logger.debug("cek latlng : get address = lat =$latitude lng $longitude")
  6. try {
  7.  
  8. addresses = Geocoder(this)
  9. .getFromLocation(
  10. latitude,
  11. longitude,
  12. 1
  13. )
  14. val cityName = addresses?.get(0)?.getAddressLine(0)
  15. resultAddress = cityName ?: ""
  16.  
  17. Logger.debug("cek latlng : resultaddress $resultAddress")
  18.  
  19. }
  20. catch (e: IOException) {
  21. Logger.debug("ERROR IO EXCEPTION")
  22.  
  23. }
  24. catch (e: Exception) {
  25. Logger.debug("ERROR GENERAL")
  26. }
  27. address = resultAddress
  28. tv_addres_user.text = address
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement