이제 Android 11 개발자 프리뷰를 사용할 수 있습니다. 테스트해 보고 의견을 공유하세요.
added in version 1.0.0
belongs to Maven artifact android.arch.lifecycle:viewmodel:1.1.1

ViewModelProvider.Factory

public static interface ViewModelProvider.Factory

android.arch.lifecycle.ViewModelProvider.Factory


Implementations of Factory interface are responsible to instantiate ViewModels.

Summary

Public methods

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

Creates a new instance of the given Class.

Public methods

create

added in version 1.0.0
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