问题
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