architecture-components-samples icon indicating copy to clipboard operation
architecture-components-samples copied to clipboard

Performed fragment injection in onFragmentAttached instead onFragmentCreated

Open nayan-dhabarde opened this issue 3 years ago • 2 comments

Performing AndroidSupportInjection.inject method in onCreate of Fragment Life Cycle can lead to inconsistencies when the fragment is reattached which leads to the issue in which androidInjector() in the fragment returns null.

It is recommended in the Dagger documentation to perform it in onAttach() as mentioned in When to Inject

nayan-dhabarde avatar Mar 03 '21 12:03 nayan-dhabarde

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

google-cla[bot] avatar Mar 03 '21 12:03 google-cla[bot]

@googlebot I signed it!

nayan-dhabarde avatar Mar 03 '21 12:03 nayan-dhabarde