VastVmFragment
VastVmActivity.
// Because don't using the ViewBinding,so just set the layoutId to layout id.
class SampleVmFragment(override val layoutId: Int = R.layout.fragment_sample_vm) : VastVmFragment<SampleSharedVM>()
{
override fun initView(view: View, savedInstanceState: Bundle?) {
// Something to do
}
}
Content copied to clipboard
Parameters
VM
ViewModel of the fragment.
Functions
Link copied to clipboard
Get the ViewModel. By default, it will throw a IllegalStateException.
Link copied to clipboard
open override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?
Link copied to clipboard
When setVmBySelf is true, it means that ViewModelStoreOwner is Fragment itself. When you want ViewModelStoreOwner to be the androidx.fragment.app.FragmentActivity this fragment is currently associated with, set setVmBySelf to false.