Last active
December 4, 2017 11:35
-
-
Save RohitSurwase/6656a3b2ec508dbd9dcf2b3ea691d8bf to your computer and use it in GitHub Desktop.
Calling Viewpager Fragment's Function on it's Visibility - Solid Solution.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean notFirstTime; | |
@Override | |
public void setUserVisibleHint(boolean isVisibleToUser) { | |
super.setUserVisibleHint(isVisibleToUser); | |
if (isVisibleToUser && notFirstTime) { | |
//TODO: Call function to be executed every time. | |
requestData(); | |
} | |
} | |
@Override | |
public void onResume() { | |
super.onResume(); | |
notFirstTime = true; | |
if (getUserVisibleHint()) { | |
//TODO: Call function to be executed every time. | |
requestData(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment