Hey folks, is it a bad practice to get the Fragment's Presenter (MVP arch) lazily via
by inject
like this:
private val presenter: MySamplePresenter by inject { parametersOf(requireContext(), get()) }
at the top of the Fragment? (not in lifecycle events like onViewCreated etc). Is this gonna cause a memory leak on screen rotation? (cause then fragment is retained during configuration change but view is destroyed and recreated)
a
arnaud.giuliani
02/26/2021, 5:13 PM
Your presenter shouldn’t be retained if declared as factory
👍 1
t
tynn
02/27/2021, 9:02 AM
The
requireContext()
part might raise some issues. Try to use
androidContext()
within your factory instead. Or maybe try to not use a context within your presenter...