How YouTube handles the lifecycle of their tab's Fragments? When I tap on the tab it starts and continues loading the data even though I switched that tab. And when I reselect that tab again it does not reload it's view and data. I think that there are some boolean variables like didFeedLoad, which is then set true in onCreate? But in my opinion this is not elegant and good solution. What do ya think?

In my app instead of ViewPager and TabLayout I have BottomNavigationView, but I want to handle lifecycle like in YouTube Android App 

Here is the code of navigation:

```
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.frame_layout, new OneFragment());
fragmentTransaction.commit();
BottomNavigationView bottomNavigationView =
            (BottomNavigationView) findViewById(R.id.bottom_navigation_view);

bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            Fragment fragment = null;
            switch (item.getItemId()) {
                case R.id.action_one:
                    fragment = new OneFragment();
                    break;
                case R.id.action_two:
                    fragment = new TwoFragment();
                    break;
                case R.id.action_three:
                    fragment = new ThreeFragment();
                    break;
                case R.id.action_four:
                    fragment = new FourFragment();
                    break;
                case R.id.action_five:
                    fragment = new FiveFragment();
                    break;
            }
            if (fragment != null) {
                FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
                fragmentTransaction.replace(R.id.frame_layout, fragment);
                fragmentTransaction.commit();
            }
            return true;
        }
    });

```