SetUserVisibleHint () method call in Fragment, setuservisiblehint

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.