Take action when fragment finishes loading correctly

I would like to know when the fragment completed the download correctly and nexr will execute the action. I do not know how I can do this!

Thanks.

+4
source share
3 answers

Perform the action in the onStart or onResume .

 @Override public void onResume() { super.onResume(); //perform action } 
0
source

What exactly do you mean when you say "finished the download correctly"? Do you perform any long-term task in your fragment or just want to know when this fragment passed through a standard lifecycle ?

If you just need to know when the installation will be completed, you should, as posted in another answer, override onStart ()

0
source

You can call api

 if(fragment.isAdded()) { } 

to check if a fragment has been added to the current activity.

-1
source

Source: https://habr.com/ru/post/1479593/


All Articles