getFragmentManager() not working in Kotlin
Since your searchDialogFragment
variable is marked as nullable with the question mark in the declaration you need to use the safe call operator ?.
. It only executes when searchDialogFragment
is not null:
searchDialogFragment?.show(supportFragmentManager, null)
Or you could use the following to declare your variable as not null but still be able to initialize it later in your code:
private lateinit var searchDialogFragment: SearchDialogFragment