UninitializedPropertyAccessException in Android Studio with viewModel
I'm New to Kotlin and Android Studio and trying to implement Room database with ViewModel now, but I face the problem "kotlin.UninitializedPropertyAccessException: lateinit property habitViewModel has not been initialized"
I think that this is due to the early initialization of View Model, but I can't find the way to fix it.
This is my code below.
Activity OnCreate Code
class HabitActivity : AppCompatActivity() {
lateinit var binding : ActivityHabitBinding
lateinit var habitViewModel...