Life-cycle approach called when the Android Fragment hide or display

Fragment use generally in two ways:

If we want to use a different Fragment, Fragment hide and display method called life cycle is different, the following is Fragment show hidden method call:

// determines whether the display - in conjunction with ViewPager, for about switching
@Override
public void setUserVisibleHint (Boolean isVisibleToUser) {
super.setUserVisibleHint (isVisibleToUser);
IF (isVisibleToUser) // Display
}

// determines whether the display - and the like used in conjunction RadioGroup, clicking switch
@Override
public void onHiddenChanged (Boolean hidden) {
super.onHiddenChanged (hidden);
IF (hidden!) // Display
}
---------- -----------
author: Yu_yan_ran
source: CSDN
original: https: //blog.csdn.net/Yu_yan_ran/article/details/73649720
copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/derekhan/p/11094681.html