Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 2.0.0
belongs to Maven artifact androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01

ViewModelProvider.NewInstanceFactory

public static class ViewModelProvider.NewInstanceFactory
extends Object implements ViewModelProvider.Factory

java.lang.Object
   ↳ androidx.lifecycle.ViewModelProvider.NewInstanceFactory


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

Summary

Public constructors

ViewModelProvider.NewInstanceFactory()

Public methods

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

Creates a new instance of the given Class.

Inherited methods

Public constructors

ViewModelProvider.NewInstanceFactory

added in version 2.0.0
public ViewModelProvider.NewInstanceFactory ()

Public methods

create

added in version 2.0.0
public T create (Class<T> modelClass)

Creates a new instance of the given Class.

Parameters
modelClass Class: a Class whose instance is requested

Returns
T a newly created ViewModel