Forum

Android Studio, Kot...
 
Notifications
Clear all

Android Studio, Kotlin, GoogleMaps - city name to lat lon location

1 Posty
1 Users
0 Reactions
1,229 Widok
0
Topic starter

example

1 Answer
0
Topic starter
        map.setMinZoomPreference(12F)

        val geoCoder = Geocoder(this)
        val addresses: List = geoCoder.getFromLocationName("__MY_CITY_NAME__", 1)

        val lat = addresses[0].latitude
        val lon = addresses[0].longitude

        val ny = LatLng(lat, lon)

        map.moveCamera(CameraUpdateFactory.newLatLng(ny))
        googleMap.onResume()

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: