added in version 2.0.0
belongs to Maven artifact androidx.lifecycle:lifecycle-viewmodel:2.0.0-beta01

AndroidViewModel

public class AndroidViewModel
extends ViewModel

java.lang.Object
   ↳ androidx.lifecycle.ViewModel
     ↳ androidx.lifecycle.AndroidViewModel


Application context aware ViewModel.

Subclasses must have a constructor which accepts Application as the only parameter.

Summary

Public constructors

AndroidViewModel(Application application)

Public methods

<T extends Application> T getApplication()

Return the application.

Inherited methods

Public constructors

AndroidViewModel

added in version 2.0.0
public AndroidViewModel (Application application)

Parameters
application Application

Public methods

getApplication

added in version 2.0.0
public T getApplication ()

Return the application.

Returns
T