Reputation: 804
I'm converting part of an app to kotlin and I've a problem caused by the intellisense of Android Studio (3.5.3) not showing all methods of googleMaps
this is an example:
override fun onMapReady(googleMap: GoogleMap) {
map = googleMap
map.setBuildingsEnabled(true)
map.setTrafficEnabled(true)
map.setOnMapLoadedCallback(OnMapLoadedCallback {
if (currentMission != null) {
drawMission()
} else {
drawNoMission()
}
})
}
for instance I can't see map.setBuildingsEnabled
in intellisense, see image
but if I force to call that hidden method, the app still builds, so it's something caused by kotlin or intellisense It may be related to the gray suggestion I got regarding property access maybe (but this isn't a property because on google maps there isn't a getBuildingsEnabled
did anyone knows how to fix this annoying problem? I don't want kotlin to hide methods that may be useful to me, thanks.
Upvotes: 0
Views: 163
Reputation: 970
Methods that follow the Java conventions for getters and setters (no-argument methods with names starting with ‘get’ and single-argument methods with names starting with ‘set’) are represented as properties in Kotlin.
In other words if you had a Java method setTrafficEnabled(true)
Kotlin will provide you a property access syntax isTrafficEnabled = true
. This is one of Kotlin advantages.
If you ignore Kotlin property access syntax and use getters and setters, it will work all the same.
Upvotes: 1