-
public class ViewModelContextCreation context for the ViewModel. Includes the ViewModel store owner (either an activity or fragment), and fragment arguments set via Mavericks.KEY_ARG.
For activity scoped ViewModels see ActivityViewModelContext. For fragment scoped ViewModels see FragmentViewModelContext.
Never store a reference to this context, or the activity/fragment.
-
-
Field Summary
Fields Modifier and Type Field Description private final ComponentActivityactivityprivate final Objectargs
-
Method Summary
Modifier and Type Method Description abstract ComponentActivitygetActivity()The activity which is using the ViewModel. abstract ObjectgetArgs()Fragment arguments set via Mavericks.KEY_ARG. final <A extends ComponentActivity> Aactivity()Convenience method to type activity. final <A extends Application> Aapp()Convenience method to access a typed Application. final <A extends Any> Aargs()Convenience method to type args. -
-
Method Detail
-
getActivity
abstract ComponentActivity getActivity()
The activity which is using the ViewModel.
-
getArgs
abstract Object getArgs()
Fragment arguments set via Mavericks.KEY_ARG.
-
activity
final <A extends ComponentActivity> A activity()
Convenience method to type activity.
-
app
final <A extends Application> A app()
Convenience method to access a typed Application.
-
-
-
-