I'm trying to create a simple unbound service in kotlin, but I can't. When I override onBind()
method in Java I can return null
, but in kotlin it says I'm only allowed to return IBinder
and not IBinder?
, that means it can't be null
. Any ideas how to fix that except rewriting MyService class into Java?
[SOLVED] Thank you, guys! I can realy change IBinder
to IBinder?
. It works!!
override fun onBind(intent: Intent): IBinder?
and generating the override in Android Studio gave meoverride fun onBind(intent: Intent?): IBinder
but I was able to change that toIBinder?
without issue – Yarbrough