I have four tabs and its four fragments attached. Swiping will take you to next fragment or tab.
All four fragments have the dynamic data from the server.
First time it was loading 1st and 2nd fragments loading. then swiping to right 3rd loading and 1st detaching, but I am in 2nd fragment.
Now, I swipe to left the loading for 3rd fragment not completed. So it was taking more time to load. I am in 1st fragment the background process of 3rd is still running and showing the toast message and all.
How to give preference or detaching the unwanted fragment to overcome this problem.
Or can you give some good suggestions to this problem
As per the stackOverflow answer I did.
https://stackoverflow.com/a/20350313/4675067
boolean Loaded = false;
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser && !Loaded ) {
loadLectures();
Loaded = true;
}
}