Android Emulator Showing Empty Screen?
I am developing a news app previously it was showing JSON response but now showing the empty white screen below fragment class where I have implemented dagger 2 and retrofit' publi
Solution 1:
Regarding Dagger setup, this line of cast does not seem correct:
// BBCSportFragment.onCreate > Callback.onResponse
(BBCSportFragmentComponent) DaggerApplicationComponent.builder().contextModule(newContextModule(getContext())).build();
A correct setup should not require you to cast the result of .build()
.
If BBCSportFragmentComponent
is using component dependency (with an annotation like @Component(dependencies = ApplicationComponent.class)
), maybe you mean this:
bbcSportFragmentComponent =
DaggerBBCSportFragmentComponent.builder()
.applicationComponent(applicationComponent)
.contextModule(newContextModule(getContext()))
.build();
bbcSportFragmentComponent.injectBBCSportFragment(BBCSportFragment.this);
Then, the fields that Dagger should inject should be annotated @Inject
. Otherwise bbcSportFragmentComponent.injectBBCSportFragment
will run successfully doing nothing.
Then, Dagger documentation suggests injecting a Fragment inside onAttach
before super.onAttach()
.
Post a Comment for "Android Emulator Showing Empty Screen?"