title: How to get previous destination with navigation component?
body: <p>I have fragments A, B, C, and X where their navigations are as the following. </p>
  
  <pre><code> A --&gt; X 
   B --&gt; X 
   C --&gt; X
  </code></pre>
  
  <p>How could I know the information of the last or previous destination in X?</p>
  
  <p>The current destination ID can be found by </p>
  
  <pre><code>Navigation.findNavController(v).getCurrentDestination().getId()
  </code></pre>
  
  <p>I also tried using <code>getBackStackEntry(int destinationId)</code> but it returns only the topmost NavBackStackEntry for a destination id. In other words, the current destination.</p>
  
  <p>Also <code>getActivity().getSupportFragmentManager().getBackStackEntryCount();</code> returning 0.</p>
  
  <p>Possible solutions are:</p>
  
  <ol>
  <li>Pass data from A, B, and C to X and identify the previous fragment by
  checking with that data.</li>
  <li>Use shared SharedViewModel.</li>
  </ol>
  
  <p>Is it possible to get the current destination?</p>