Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private fun getAddressWithLocation() {
- this.latitude = latitude
- this.longitude = longitude
- var resultAddress = ""
- Logger.debug("cek latlng : get address = lat =$latitude lng $longitude")
- try {
- addresses = Geocoder(this)
- .getFromLocation(
- latitude,
- longitude,
- 1
- )
- val cityName = addresses?.get(0)?.getAddressLine(0)
- resultAddress = cityName ?: ""
- Logger.debug("cek latlng : resultaddress $resultAddress")
- }
- catch (e: IOException) {
- Logger.debug("ERROR IO EXCEPTION")
- }
- catch (e: Exception) {
- Logger.debug("ERROR GENERAL")
- }
- address = resultAddress
- tv_addres_user.text = address
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement