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(@NonNull Class<@NonNull T> modelClass)

Creates a new instance of the given Class.

Public constructors

NewInstanceFactory

public final NewInstanceFactory()

Public methods

create

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

Creates a new instance of the given Class.

Parameters
@NonNull Class<@NonNull T> modelClass

a Class whose instance is requested

Returns
T

a newly created ViewModel