title: How to remove animation between the same fragments?
body: <p>I want to avoid transition between fragments when I choose fragment which is currently displayed.</p>
  
  <pre><code>public boolean onSelect(View view, int index) {
      switch (view.getId()) {
          case R.id.toDiary:
              getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left,
                      R.anim.slide_in_right, R.anim.slide_out_right).replace(R.id.fragment_container,
                      new DiaryFragment()).addToBackStack("Diary").commit();
              break;
          case R.id.toForecast:
              getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left,
                      R.anim.slide_in_right, R.anim.slide_out_right).replace(R.id.fragment_container,
                      new ForecastFragment()).addToBackStack("Forecast").commit();
              break;
          case R.id.toCharts:
              getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left,
                      R.anim.slide_in_right, R.anim.slide_out_right).replace(R.id.fragment_container,
                      new ChartsFragment()).addToBackStack("Charts").commit();
              break;
          case R.id.toSettings:
              getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left,
                      R.anim.slide_in_right, R.anim.slide_out_right).replace(R.id.fragment_container,
                      new SettingsFragment()).addToBackStack("Settings").commit();
              break;
      }
      drawer.closeDrawer(GravityCompat.START);
      return true;
  }
  </code></pre>
  
  <p><strong>Animation</strong> which may help you understand my problem:</p>
  
  <p><a href="https://i.stack.imgur.com/Q1Cvg.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q1Cvg.gif" alt="enter image description here"></a></p>
  
  <p>So to put it simply I don't want to see animation when user already sees chosen fragment.</p>
  
  <p>I tried to keep variable <code>currentLaunchedFragment</code> and check if user chose fragment which is currently displayed but the problem is that I use <code>.addToBackStack("")</code> which I use in order to enable going back to previously displayed fragment. The problem is that I couldn't find any way to actualize <code>currentLaunchedFragment</code> while clicking back button which produces another unwanted behavior.</p>