ViewModelProvider.NewInstanceFactory



Simple factory, which calls empty constructor on the give class.

Summary

Public constructors

android

Public functions

open T
<T : ViewModel> create(modelClass: KClass<T>, extras: CreationExtras)

Creates a new instance of the given modelClass.

android

Public constructors

NewInstanceFactory

NewInstanceFactory()

Public functions

create

open fun <T : ViewModel> create(modelClass: KClass<T>, extras: CreationExtras): T

Creates a new instance of the given modelClass.

Parameters
modelClass: KClass<T>

KClass of the ViewModel to create

extras: CreationExtras

CreationExtras passed to the Factory to create the ViewModel

Returns
T

new ViewModel instance of type T