In Android, there is a android.location.LocationListener
class, and the Android Operating System updates locations using the class as below:
It says that Location is @NonNull, but in reality the OS does return null sometimes, which crashes the app.
object : LocationListener {
override fun onLocationChanged(location: Location) {
doSomethingWithLocation(location) // App crashes here, because location is null
}
}
Is there some way to tell the compiler that Location
is actually Location?
?