@Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if(getUserVisibleHint()) {
            isVisible = true;
            onVisible();
        } else {
            isVisible = false;
            onInvisible();
        }
    }
http://msdx.github.io/AndroidSnippet/com/githang/android/snippet/app/LazyFragment.html
app/src/main/java/org/estgroup/phphub/common/base/LazyFragment.java