이제 Android 11 개발자 프리뷰를 사용할 수 있습니다. 테스트해 보고 의견을 공유하세요.

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

public AndroidViewModel (Application application)

Parameters
application Application

Public methods

getApplication

public T getApplication ()

Return the application.

Returns
T