title: How to use setUserVisibleHint in Fragment on Android
body: <p>In my application i have <code>BottomNavBar</code> and i want show <code>fragments</code> when click on items of this <code>BottomNavBar</code>! <br>
  For set this <code>fragments</code> with <code>BottomNavBar</code> i used <a href="https://developer.android.com/guide/navigation/navigation-design-graph" rel="noreferrer"><code>NavigationGraph</code></a> component! </p>
  
  <p>I want use <strong><code>setUserVisibleHint</code></strong> method for one of this <code>fragment</code>, but when show this <code>fragment</code> not call <strong><code>setUserVisibleHint</code></strong> !</p>
  
  <p><strong>My Activity codes</strong> for set <code>fragments</code> to <code>BottomNavBar</code> items : </p>
  
  <pre><code>class HomeActivity : BaseActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  
      setupNavigation()
  
      }
  
          private fun setupNavigation() {
          val navController = Navigation.findNavController(this, R.id.homePage_fragmentNavHost)
          NavigationUI.setupWithNavController(homePage_bottomNavBar, navController)
      }
  
      override fun onSupportNavigateUp() = Navigation.findNavController(this, R.id.homePage_fragmentNavHost).navigateUp()
  }
  </code></pre>
  
  <p><strong>My Fragment codes :</strong> </p>
  
  <pre><code>class HomeDashboardFragment : Fragment(){
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.fragment_home_dashboard, container, false)
      }
  
      override fun setUserVisibleHint(isVisibleToUser: Boolean) {
          super.setUserVisibleHint(isVisibleToUser)
          if (isVisibleToUser) {
              Handler().postDelayed({ requireContext().toast("Show") }, 500)
          }
      }
  }
  </code></pre>
  
  <p>Why not work <code>setUserVisibleHint</code> into <code>fragment</code> ?</p>