Class DefaultViewModelFactories

java.lang.Object
dagger.hilt.android.internal.lifecycle.DefaultViewModelFactories

public final class DefaultViewModelFactories extends 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 Details

    • 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!