简体   繁体   中英

checking savedInstanceState state in fragment

Why don't we check savedInstanceState in onCreateView callback of fragment instead of onActivityCreated (Recommended)? According to life cycle of fragment onActivityCreated called after the onCreateView callback in fragment lifecycle.

If you go through this article it is clearly explained that you can call onSaveInstanceState anytime before onDestroy . So to answer your question, you can call that method in onCreateView method also.

Google Developer Link - Fragment onSaveInstanceState

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM