Complete the code to create a ViewModel class named MyViewModel.
class MyViewModel : [1]() { }
The ViewModel class must extend the ViewModel base class to hold UI data.
Complete the code to get a ViewModel instance inside an Activity.
val viewModel = ViewModelProvider(this).[1](MyViewModel::class.java)
Use get() to retrieve the ViewModel instance from ViewModelProvider.
Fix the error in the ViewModel class declaration to use the correct import for ViewModel.
import androidx.lifecycle.[1] class MyViewModel : ViewModel() { }
The ViewModel class is imported from androidx.lifecycle.ViewModel.
Fill both blanks to create a ViewModel with a factory inside a Fragment.
val viewModel = ViewModelProvider(this, [1]()).[2](MyViewModel::class.java)
Use a custom factory class MyViewModelFactory and call get() to obtain the ViewModel.
Fill all three blanks to create a ViewModel with saved state support inside an Activity.
val viewModel = ViewModelProvider(this, [1](application, [2])).[3](MyViewModel::class.java)
Use SavedStateViewModelFactory with the savedStateRegistryOwner and call get() to get the ViewModel.