dagger-2

WorkManager : How to set-up different WorkManager Configurations in same App

萝らか妹 提交于 2021-01-04 05:43:09
问题 I'm working on a multi module project (Gradle module). I'm using WorkManager in my module. I'm also making use of Dagger for dependency injection. Now I have to use dagger to inject dependencies to my WorkManager. I'm quite familiar with Dagger 2 setup with WorkManager. But the problem I'm facing is, I have to use worker factory to make it compatible with dagger. So that I can inject dependencies with the help of Dagger Multi bindings. But currently the WorkManager configuration in the main

WorkManager : How to set-up different WorkManager Configurations in same App

巧了我就是萌 提交于 2021-01-04 05:42:53
问题 I'm working on a multi module project (Gradle module). I'm using WorkManager in my module. I'm also making use of Dagger for dependency injection. Now I have to use dagger to inject dependencies to my WorkManager. I'm quite familiar with Dagger 2 setup with WorkManager. But the problem I'm facing is, I have to use worker factory to make it compatible with dagger. So that I can inject dependencies with the help of Dagger Multi bindings. But currently the WorkManager configuration in the main

WorkManager : How to set-up different WorkManager Configurations in same App

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-04 05:42:05
问题 I'm working on a multi module project (Gradle module). I'm using WorkManager in my module. I'm also making use of Dagger for dependency injection. Now I have to use dagger to inject dependencies to my WorkManager. I'm quite familiar with Dagger 2 setup with WorkManager. But the problem I'm facing is, I have to use worker factory to make it compatible with dagger. So that I can inject dependencies with the help of Dagger Multi bindings. But currently the WorkManager configuration in the main

is it ok to inject content view using dagger2

╄→гoц情女王★ 提交于 2020-12-13 04:12:12
问题 I'm using data binding in my android project, also i'm using dagger 2 for DI . basically for setting content view with data binding i need to do something like this : LayoutClass layoutClass = DataBindingUtil.setContentView(Activity, Layout); I'm providing that layoutClass in dagger module and injecting it to my activity. the question is, is this a good practice ? 回答1: Technically you're defining a circle-reference with this. You're just not warned, because setting up the graph requires you

is it ok to inject content view using dagger2

拥有回忆 提交于 2020-12-13 04:10:37
问题 I'm using data binding in my android project, also i'm using dagger 2 for DI . basically for setting content view with data binding i need to do something like this : LayoutClass layoutClass = DataBindingUtil.setContentView(Activity, Layout); I'm providing that layoutClass in dagger module and injecting it to my activity. the question is, is this a good practice ? 回答1: Technically you're defining a circle-reference with this. You're just not warned, because setting up the graph requires you

Kotlin lateinit not working with @Inject annotation

社会主义新天地 提交于 2020-12-12 10:53:31
问题 I am new to dagger 2 and kotlin both. Getting lateinit property not initialized. I have a module which have few @Provides methods but one of the class not able to create object which used @Inject and lateinit. Login service takes "LoginAPI" as parameter and works fine but as i want all my login related API's to use the same service. There is one more API related "LoginWithOrgAPI" . Now my need is to get any API object when needed in the LoginService class. So i tries using lateinit with

How can I inject fragment into activity so that I don't have to manually create its instance?

半腔热情 提交于 2020-12-09 16:55:44
问题 I am working on a android project and using Dagger2 for Dependency Injection? I am trying to inject Fragment into Activity but I don't want to create fragment instance , using newInstance or new SomeFragment and want the instance to be created by dagger and injected. I also want to know how can I do the same if want to some pass some arguments. 回答1: Even though you don't want to call new , Android will: This is why Fragment is required to have a zero-arg public constructor, because if you

How can I inject fragment into activity so that I don't have to manually create its instance?

▼魔方 西西 提交于 2020-12-09 16:45:50
问题 I am working on a android project and using Dagger2 for Dependency Injection? I am trying to inject Fragment into Activity but I don't want to create fragment instance , using newInstance or new SomeFragment and want the instance to be created by dagger and injected. I also want to know how can I do the same if want to some pass some arguments. 回答1: Even though you don't want to call new , Android will: This is why Fragment is required to have a zero-arg public constructor, because if you

How can I inject fragment into activity so that I don't have to manually create its instance?

家住魔仙堡 提交于 2020-12-09 16:41:10
问题 I am working on a android project and using Dagger2 for Dependency Injection? I am trying to inject Fragment into Activity but I don't want to create fragment instance , using newInstance or new SomeFragment and want the instance to be created by dagger and injected. I also want to know how can I do the same if want to some pass some arguments. 回答1: Even though you don't want to call new , Android will: This is why Fragment is required to have a zero-arg public constructor, because if you

Hilt using in android library

元气小坏坏 提交于 2020-12-03 09:12:59
问题 I would like to try Hilt DI in the android library. It is a dependency on another project, with its own submodule. The very first problem I've encountered is the requirement of marking Application with @HiltAndroidApp . Now I do not have anything that extends Application in my library ofc but would like to utilize Hilt and its predefined components. Is it possible or should I go with Dagger only in such a case? I've found a solution for Dagger, where library dependency injection is made