Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

AndroidViewModel

open class AndroidViewModel : ViewModel
kotlin.Any
   ↳ 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

<init>(@NonNull application: Application)

Public methods

open T

Return the application.

Inherited functions

Public constructors

<init>

AndroidViewModel(@NonNull application: Application)

Public methods

getApplication

@NonNull open fun <T : Application!> getApplication(): T

Return the application.