title: Fragment with viewpager load one time only
body: <p>I have simple problem.. I have MainActivity.. inside it i have 5 fragments and i can move using bottom navigation bar without problem!</p>
  
  <p>In first fragment (Profile) i have inside that tow fragment using Tablayout and Viewpager..
  First Fragment (Friends) Second Fragment (Users)..</p>
  
  <p>My problem when i run app and open (Profile) the tow fragments (Friends and Users)
  Working 100% just in first time.. when i come back to other fragment using bottom bar and come back to friends or users is empty and not load !</p>
  
  <p>I want attach some of my codes you will need it..</p>
  
  <p><strong>Profile Fragment:</strong></p>
  
  <pre><code>mSectionsPageAdapter = new 
  SectionsPageAdapter(getActivity().getSupportFragmentManager());
  
  mViewPager = (ViewPager) v.findViewById(R.id.container);
  
  setupViewPager(mViewPager);
  
  TabLayout tabLayout = (TabLayout) v.findViewById(R.id.tabs);
  
  tabLayout.setupWithViewPager(mViewPager);
  
  mSectionsPageAdapter.notifyDataSetChanged();
  
  private void setupViewPager(ViewPager viewPager) {
  
  SectionsPageAdapter adapter = new 
  SectionsPageAdapter(getActivity().getSupportFragmentManager());
  
  adapter.addFragment(new FriendsFragment(), "Friends");
  adapter.addFragment(new UsersFragment(), "Online");
  
  viewPager.setAdapter(adapter);
  }
  </code></pre>
  
  <p><strong>SectionsPageAdapter:</strong></p>
  
  <pre><code>public class SectionsPageAdapter extends FragmentPagerAdapter {
  
  private final List&lt;Fragment&gt; mFragmentList = new ArrayList&lt;&gt;();
  private final List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;();
  
  public void addFragment(Fragment fragment, String title) {
      mFragmentList.add(fragment);
      mFragmentTitleList.add(title);
  }
  
  public SectionsPageAdapter(FragmentManager fm) {
      super(fm);
  }
  
  @Override
  public CharSequence getPageTitle(int position) {
      return mFragmentTitleList.get(position);
  }
  
  @Override
  public Fragment getItem(int position) {
      return mFragmentList.get(position);
  }
  
  @Override
  public int getCount() {
      return mFragmentList.size();
  }}
  </code></pre>
  
  <p>I try to add this in Friends Fragment and Users Fragment the problem was solved but the content duplicated in first time run only.</p>
  
  <pre><code>   @Override
  public void setUserVisibleHint(boolean isVisibleToUser) {
      super.setUserVisibleHint(isVisibleToUser);
      if (isVisibleToUser) {
          getFragmentManager().beginTransaction().detach(this).attach(this).commit();
  
      }
  }
  </code></pre>
  
  <p><strong>SectionsPageAdapter:</strong></p>
  
  <pre><code>public class SectionsPageAdapter extends FragmentPagerAdapter {
  
  private final List&lt;Fragment&gt; mFragmentList = new ArrayList&lt;&gt;();
  private final List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;();
  
  public void addFragment(Fragment fragment, String title) {
      mFragmentList.add(fragment);
      mFragmentTitleList.add(title);
  }
  
  public SectionsPageAdapter(FragmentManager fm) {
      super(fm);
  }
  
  @Override
  public CharSequence getPageTitle(int position) {
      return mFragmentTitleList.get(position);
  }
  
  @Override
  public Fragment getItem(int position) {
      return mFragmentList.get(position);
  }
  
  @Override
  public int getCount() {
      return mFragmentList.size();
  }}
  </code></pre>