title: Enter/Exit animation programmatically using navigation components
body: <p>I am using Navigation Components library. When navigating to another fragment, to use animation, I understand that I can add xml code like this:</p>
  <pre><code>&lt;fragment
      android:id=&quot;@+id/specifyAmountFragment&quot;
      android:name=&quot;com.example.buybuddy.buybuddy.SpecifyAmountFragment&quot;
      android:label=&quot;fragment_specify_amount&quot;
      tools:layout=&quot;@layout/fragment_specify_amount&quot;&gt;
      &lt;action
          android:id=&quot;@+id/confirmationAction&quot;
          app:destination=&quot;@id/confirmationFragment&quot;
          app:enterAnim=&quot;@anim/slide_in_right&quot;
          app:exitAnim=&quot;@anim/slide_out_left&quot;
          app:popEnterAnim=&quot;@anim/slide_in_left&quot;
          app:popExitAnim=&quot;@anim/slide_out_right&quot; /&gt;
   &lt;/fragment&gt;
  </code></pre>
  <p>But, I need to use it programmatically.</p>
  <p>I would appreciate your answer.</p>