ViewModelProvider.NewInstanceFactory

public class ViewModelProvider.NewInstanceFactory implements ViewModelProvider.Factory

Known direct subclasses
ViewModelProvider.AndroidViewModelFactory

Factory which may create AndroidViewModel and ViewModel, which have an empty constructor.


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

Summary

Public constructors

Public methods

@NonNull T
<T extends ViewModel> create(Class<T> modelClass)

Creates a new instance of the given Class.

Public constructors

NewInstanceFactory

public final NewInstanceFactory()

Public methods

create

public @NonNull T <T extends ViewModel> create(Class<T> modelClass)

Creates a new instance of the given Class.

Parameters
Class<T> modelClass

a Class whose instance is requested

Returns
@NonNull T

a newly created ViewModel