0

I have such situation that I need get some data first and after that create retrofit, I'm using Dagger 2 to inject it. Is it possible to initialize object when inject is made? I have such code in my application module.

@Module
public class ApplicationModule {
     ...
        @Provides
        public Retrofit provideRetrofitSecure(GsonConverterFactory gsonConverterFactory) {
        .....
    }
    ....
}
Vishal Senjaliya
  • 454
  • 6
  • 21
sider
  • 687
  • 2
  • 9
  • 23
  • Does this question help you? There are some good answers there [Lazy Injection with Dagger 2 on Android](https://stackoverflow.com/questions/34049807/lazy-injection-with-dagger-2-on-android) – David Rawson May 27 '17 at 05:06

1 Answers1

0

I think that if you add this method as the following

@Provides 
 public GsonConverterFactory provideGsonConverterFactory() {
     ...
 }

to the Module you posted, objects in the module will be initialized.

Please tell me what is the problem or the question in detail, I will let you know. thank you.^_^

Sunhee
  • 101
  • 8