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

ViewModelStores

public class ViewModelStores
extends Object

java.lang.Object
   ↳ androidx.lifecycle.ViewModelStores


This class is deprecated.
Use ComponentActivity.getViewModelStore() or Fragment.getViewModelStore() to retrieve a ViewModelStore directly from activities and fragments.

Factory methods for ViewModelStore class.

Summary

Public methods

static ViewModelStore of(Fragment fragment)

This method is deprecated. Use Fragment.getViewModelStore()

static ViewModelStore of(FragmentActivity activity)

This method is deprecated. Use ComponentActivity.getViewModelStore()

Inherited methods

Public methods

of

public static ViewModelStore of (Fragment fragment)

This method is deprecated.
Use Fragment.getViewModelStore()

Returns the ViewModelStore of the given fragment.

Parameters
fragment Fragment: a fragment whose ViewModelStore is requested

Returns
ViewModelStore a ViewModelStore

of

public static ViewModelStore of (FragmentActivity activity)

This method is deprecated.
Use ComponentActivity.getViewModelStore()

Returns the ViewModelStore of the given activity.

Parameters
activity FragmentActivity: an activity whose ViewModelStore is requested

Returns
ViewModelStore a ViewModelStore