SetUserVisibleHint () method call in Fragment, setuservisiblehint
When using Fragment, you will inevitably want to do some operations in the visible and invisible views. At this time, you will usually think of methods similar to onResume () and onPause () in the Activity. The two methods are also available in Fragment. However, the two methods in support. v4.Fragment are actually the method for executing the Activity, that is, they are called only when the visibility of the Activity changes. I also found a similar method on the internet, setUserVisibleHint (), but it turns out that the method can meet the requirement without knowing it. In Fragment, the system does not call the method to rewrite the method, it must be called manually. If this method is called after a newly created Fragment is submitted, it is executed before the onCreateView () method of Fragment. The onHiddenChanged () method in Fragment can be implemented similar to onResume () this function.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.