title: ViewPager switch without showing the in between fragments
body: <p>I have a ViewPager that holds 4 fragments. When I switch from fragment1 to fragment3 or fragment4 by clicking on my bottom navigation bar, it always shows the in between fragments for a fraction amount of time. The behavior is like it has to pass fragment 2 and 3 to arrive to fragment 4. Is this normal? If so, is there a way to disable this in between animation? </p>
  
  <p>Code in my home activity which holds the 4 fragments are like this:</p>
  
  <pre><code>/**
   * view pager.
   */
  
  public void setupViewPager(ViewPager viewPager){
      Log.d(TAG, "setupViewPager: setting up viewPager.");
      SectionsStatePagerAdapter adapter = new SectionsStatePagerAdapter(getSupportFragmentManager());
      adapter.addFragment(new HomeFragment(), "HomeFragment");
      adapter.addFragment(new HashtagFragment(), "HashtagFragment");
      adapter.addFragment(new ChattingFragment(), "ChattingFragment");
      adapter.addFragment(new SettingFragment(), "SettingFragment");
      viewPager.setAdapter(adapter);
  }
  
  
  public void setViewPager(int fragmentNumber){
  
          mViewPager.setCurrentItem(fragmentNumber);
  
  }
  
  
  
  public void enableViewPagerSwitch(){
  
      mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
              if(bottomNavigationView.getMenu().getItem(position).isChecked()){
                  bottomNavigationView.getMenu().getItem(position).setChecked(false);
                  Log.d(TAG, "onPageScrolled: position is " + position);
              }
          }
  
          @Override
          public void onPageSelected(int position) {
  
              bottomNavigationView.getMenu().getItem(position).setChecked(true);
  
          }
  
          @Override
          public void onPageScrollStateChanged(int state) {
  
          }
      });
  
  }
  
  
  
  /**
   * navigation bar.
   */
  
  private void setupBottomNavigationView(){
      Log.d(TAG, "setupBottomNavigationView: setting up Bottom navigation bar.");
      BottomNavigationViewHelper.setupBottomNavigationView(bottomNavigationView);
      Menu menu = bottomNavigationView.getMenu();
      MenuItem menuItem = menu.getItem(ACTIVITY_NUM);
      menuItem.setChecked(true);
  }
  
  private void enableNavigation(){
      bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
          @Override
          public boolean onNavigationItemSelected(@NonNull MenuItem item) {
  
              switch (item.getItemId()){
                  case R.id.ic_home:
                      setViewPager(0);
                      break;
  
                  case R.id.ic_hashtag:
                      setViewPager(1);
                      break;
  
                  case R.id.ic_chat:
                      setViewPager(2);
                      break;
  
                  case R.id.ic_setting:
                      setViewPager(3);
                      break;
              }
  
              return false;
          }
      });
  
  }
  </code></pre>
  
  <p>ViewPager adapter:</p>
  
  <pre><code>public class SectionsStatePagerAdapter extends FragmentStatePagerAdapter{
  
  private final List&lt;Fragment&gt; mFragmentList = new ArrayList&lt;&gt;();
  private final List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;();
  
  public SectionsStatePagerAdapter(FragmentManager fm) {
      super(fm);
  
  }
  
  public void addFragment(Fragment fragment, String title){
      mFragmentList.add(fragment);
      mFragmentTitleList.add(title);
  }
  
  @Override
  public Fragment getItem(int position) {
      return mFragmentList.get(position);
  }
  
  @Override
  public int getCount() {
      return mFragmentList.size();
  }
  </code></pre>
  
  <p>Thanks!</p>