https://kotlinlang.org logo
#android
Title
# android
w

william

07/23/2019, 3:44 AM
if i access my view via a synthetic binding, can i access it in all lifecycle methods or only after
onCreateView
(for a
Fragment
)
im getting an NPE in
onSaveInstanceState
with it
v

voben

07/23/2019, 3:51 AM
You can only access the view when the fragment is in the resumed state.
So maybe onSaveInstanceState is getting called outside that window
w

william

07/23/2019, 4:07 AM
onSaveInstanceState
is getting called after
onPause
and
onStop
as post says: it is not safe to use synthetic imports during onCreateView(), but is it safe to call it onViewCreated()