title: Content of ViewPager disappears when navigating back and forth using Navigation Components
body: <p>After migrating my navigation to the new Jetpack Navigation Component, I found that after navigating back and forth using the the libraries, the content/layout of the first two fragments in my ViewPager disappears. After clicking through the tabs, it comes back though.</p>
  
  <p>At first I thought it was because of the errors that I saw in the logcat, but after fixing them, the problem was still there.</p>
  
  <p>Here is the code of my MainActivity:</p>
  
  <pre><code>private Toolbar toolbar;
  
  private NavigationView navigationView;
  private DrawerLayout drawerLayout;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      bindResources();
  
      // Setup Toolbar &amp; Navigation Component
      setSupportActionBar(toolbar);
      setupNavigation();
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.menu_options, menu);
      return super.onCreateOptionsMenu(menu);
  }
  
  private void setupNavigation() {
      NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
  
      AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph())
              .setDrawerLayout(drawerLayout)
              .build();
  
      NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration);
      NavigationUI.setupWithNavController(navigationView, navController);
  }
  </code></pre>
  
  <p>Here is the code of my ViewPagerAdapter:</p>
  
  <pre><code>private final List&lt;Fragment&gt; fragmentList = new ArrayList&lt;&gt;();
  private final List&lt;String&gt; fragmentTitleList = new ArrayList&lt;&gt;();
  
  public ViewPagerAdapter(@NonNull FragmentManager fm) {
      super(fm);
  }
  
  public void addFragment(@NonNull Fragment fragment, String title) {
      fragmentList.add(fragment);
      fragmentTitleList.add(title);
  }
  
  @NonNull
  @Override
  public Fragment getItem(int position) {
      return fragmentList.get(position);
  }
  
  @Override
  public int getCount() {
      return fragmentList.size();
  }
  
  @Nullable
  @Override
  public CharSequence getPageTitle(int position) {
      return fragmentTitleList.get(position);
  }
  </code></pre>
  
  <p>This is my HomeFragment:</p>
  
  <pre><code>@Override
  public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
      bindResources(view);
  
      // ViewPager
      ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(getActivity().getSupportFragmentManager());
      viewPagerAdapter.addFragment(new TodayFragment(), getString(R.string.tab_today_title));
      viewPagerAdapter.addFragment(new PriorityFragment(), getString(R.string.tab_priority_title));
      viewPagerAdapter.addFragment(new PlannedFragment(), getString(R.string.tab_planned_title));
      viewPagerAdapter.addFragment(new TasksFragment(), getString(R.string.tab_tasks_title));
      viewPager.setAdapter(viewPagerAdapter);
  
      // TabLayout
      tabLayout.setupWithViewPager(viewPager);
  }
  </code></pre>