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

Eric Bergman picture Eric Bergman · Aug 2, 2013 · Viewed 16.3k times · Source

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?

Answer

Roberto Lombardini picture Roberto Lombardini · Aug 2, 2013

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.