Closed goodibunakov closed 3 years ago
Please describe the issue
I have to use BaseActivity in my project. I did:
class SplashActivity : BaseActivity<SplashViewModel>() {
private val binding by viewBinding(ActivitySplashBinding::bind, R.id.container)
}
abstract class BaseActivity<T : BaseActivityViewModel> : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
And received: Unable to start activity ComponentInfo{....SplashActivity}: java.lang.NullPointerException: activity.findViewById(viewBindingRootId) must not be null
You need to set content view before access to the viewbinding delegate
Or with BaseFragment