why this error?
09-12 16:36:31.502 1886-1886/com.getloction.nourmedhat.smartgate.getlocation E/AndroidRuntime: FATAL EXCEPTION: main Process: com.getloction
As commented by AlexTa you're getting a TypeCastException
because you cast null
to a non-null type.
In Kotlin types are "@NotNull" by default. So if you declare a variable like this:
var yourVar: String
you cannot assign null to it. If it should be capable of storing null
(which it often shouldn't) you declare it like this:
var yourVar: String? = null