java.lang.ClassCastException: com.eng.bt_eng_mobility.viewmodel.HomeViewModelFactory cannot be cast to androidx.lifecycle.ViewModel
I am getting this error. I have created ViewModelFactory class inside same ViewModel class file.
When Im trying to initialise the viewmodel I am getting this error.
//Code written in fragment class in onCreateView after binding code//
homeViewModelFactory = HomeViewModelFactory((requireActivity().application as Application).repository)
homeViewModel = ViewModelProvider(this, homeViewModelFactory)
.get(HomeViewModel::class.java)
//Viewmodelfactoryclass//
class...