Class DefaultViewModelFactories


  • public final class DefaultViewModelFactories
    extends java.lang.Object
    Modules and entry points for the default view model factory used by activities and fragments annotated with @AndroidEntryPoint.

    Entry points are used to acquire the factory because injected fields in the generated activities and fragments are ignored by Dagger when using the transform due to the generated class not being part of the hierarchy during compile time.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static androidx.lifecycle.ViewModelProvider.Factory getActivityFactory​(androidx.activity.ComponentActivity activity, androidx.lifecycle.ViewModelProvider.Factory delegateFactory)
      Retrieves the default view model factory for the activity.
      static androidx.lifecycle.ViewModelProvider.Factory getFragmentFactory​(androidx.fragment.app.Fragment fragment, androidx.lifecycle.ViewModelProvider.Factory delegateFactory)
      Retrieves the default view model factory for the activity.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getActivityFactory

        public static androidx.lifecycle.ViewModelProvider.Factory getActivityFactory​(androidx.activity.ComponentActivity activity,
                                                                                      androidx.lifecycle.ViewModelProvider.Factory delegateFactory)
        Retrieves the default view model factory for the activity.

        Do not use except in Hilt generated code!

      • getFragmentFactory

        public static androidx.lifecycle.ViewModelProvider.Factory getFragmentFactory​(androidx.fragment.app.Fragment fragment,
                                                                                      androidx.lifecycle.ViewModelProvider.Factory delegateFactory)
        Retrieves the default view model factory for the activity.

        Do not use except in Hilt generated code!