Fragment/Activity Lifecycles and Orientation Change

扶醉桌前 提交于 2019-12-03 00:58:19

Argh,

01-04 15:46:23.175: W/MainMenuFragment   0: onAttach() to SinglePaneActivity 0
01-04 15:46:23.179: W/MainMenuFragment   0: onCreate()
01-04 15:46:23.246: W/MainMenuFragment   0: onActivityCreated() with Activity SinglePaneActivity 0
01-04 15:46:23.269: W/MainMenuFragment   0: onStart()
01-04 15:46:23.269: W/SinglePaneActivity 0: onStart()

Why the heck there is an onAttach() method I have no idea. Especially since "attach" happens before there is an Activity.

The method I needed was of course, onActivityCreated() which happens as the final call in the "Creation" set of Fragment lifecycle events.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!