android - Can onViewCreated be called before Activity onCreate finishes? -
i trying redesign fragments remove dependencies onattach , onactivitycreated overrides , instead activity later on in onviewcreated override.
are there cases in android application lifecycle onviewcreated fragment called before activity oncreate finishes. example know that:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); }
will not result in fragments onattach being called (assuming fragment added fragment manager programmatically later on), in rare cases configuration updates fragment manager can recreate fragments in super.oncreate causes onattach called before oncreate activity has finished.
oncreate() system calls when creating fragment. within implementation, should initialize essential components of fragment want retain when fragment paused or stopped, resumed.
oncreateview() called create view hierarchy associated fragment.
the system calls when it's time fragment draw user interface first time. draw ui fragment, must return view method root of fragment's layout. can return null if fragment not provide ui.
refer fragments life cycle
Comments
Post a Comment