title: How Do I Add Fragment To Bottom Navigation In Kotlin?
body: <p>How do I add the <code>Fragment</code> once I hit the bottom navigation button so that it doesn't keep the stack forever?</p>
  <pre class="lang-java prettyprint-override"><code>private fun navBottomClick() 
  {
      bottomNavigationView?.setOnItemSelectedListener {
          var intent = Intent()
  
          when(it.itemId){
              R.id.workout -&gt; {
                  val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
                  fragmentTransaction.replace(R.id.container,WorkoutFragment(),&quot;WORKOUT&quot;)
                  fragmentTransaction.addToBackStack(&quot;WORKOUT&quot;)
                  fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
                  fragmentTransaction.commit()
              }
              
              R.id.steps -&gt; {
                  intent = Intent(this,StepsActivity::class.java)
                  startActivity(intent)
              }
          }
          true
      }
  }
  </code></pre>