Closed fredagsfys closed 6 years ago
Hi! I never had the issue you're talking about. Here are the docs: https://developer.android.com/guide/components/fragments.html
It says that onAttach
happens before onCreate
, so everything should be OK.
Do you have a reproducible example?
Issue is resolved and has nothing to do with the explained issue above.
We traced it down to textChanged()
using rxbindings
.
Backing really fast within the app and using textChanged()
in onResume()
with a call to getPresenter
on Subscribe
got us a null exception
which indicated that Presenters
dependencies were not injected.
Hi, looking at this example: https://github.com/konmik/nucleus/blob/master/nucleus-example-real-life/src/main/java/nucleus/example/ui/base/BaseFragment.java#L20
getActivity()
is being called inonCreate()
which doesn't guarantee that the fragment is attached to its host yet. We have experienced it the hard way in our application 💃We are utilizing a
BaseFragment
were I guess we have to either useisAdded()
check or put it elsewhere like atonActivityCreated()
and then in our Fragment callgetPresenter()
either inonStart()
oronActivityCreated()
to not get a crash.Was this written on purpose to be as simple as possible or did i miss something?