Android: How to know if a Fragment has finished loading entire content?

百般思念 提交于 2019-12-12 11:07:09

问题


Is there anyway to know that a Fragment has finish loading the entire contents of the Fragment?

The reason I'm asking is because in the onResume state when I put the application in the background I Re-Load the Fragment by executing an AsyncTask but I only want to Re-Load the Fragment that was put in the background only if the Fragment has not finished loading the entire contents of the layout (images, shapes, data, etc...)

is there anyway to know if the Fragment has been fully loaded?


回答1:


If u just want to know when your Fragment layout is fully inflated u might want to use onActivityCreated(Bundle savedInstanceState) that is called after onCreate and onCreateView.
You can find more information about Fragment life-cycle here

Anyway, if u want more accurate answer post some of your code and make and example to better describe your purpose.



来源:https://stackoverflow.com/questions/18020205/android-how-to-know-if-a-fragment-has-finished-loading-entire-content

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