public class

ViewModelProvider.AndroidViewModelFactory

extends ViewModelProvider.NewInstanceFactory

 java.lang.Object

androidx.lifecycle.ViewModelProvider.NewInstanceFactory

↳androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory

Subclasses:

ViewModelProviders.DefaultFactory

Overview

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

Summary

Constructors
publicAndroidViewModelFactory(Application application)

Creates a AndroidViewModelFactory

Methods
public ViewModelcreate(java.lang.Class<ViewModel> modelClass)

public static ViewModelProvider.AndroidViewModelFactorygetInstance(Application application)

Retrieve a singleton instance of AndroidViewModelFactory.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public AndroidViewModelFactory(Application application)

Creates a AndroidViewModelFactory

Parameters:

application: an application to pass in AndroidViewModel

Methods

public static ViewModelProvider.AndroidViewModelFactory getInstance(Application application)

Retrieve a singleton instance of AndroidViewModelFactory.

Parameters:

application: an application to pass in AndroidViewModel

Returns:

A valid ViewModelProvider.AndroidViewModelFactory

public ViewModel create(java.lang.Class<ViewModel> modelClass)