title: List the fragments on the backstack when using Android's navigation component
body: <p>I'm trying to debug some code and was hoping to list the fragments in the current backstack in Android. The stock solution is to simply list them from the support manager, so from a <em>method</em> within an <em>activity</em> :</p>
  
  <pre><code>Log.i("fragments","Count : " + supportFragmentManager.fragments.toString())
  </code></pre>
  
  <p>However using this along with Android's navigation component simply lists the navigation host fragment.</p>
  
  <pre><code>... I/fragments: [NavHostFragment{b1a2d20 (f8ec2420-b534-42df-89f0-0cb189610a26) id=0x7f080001}]
  </code></pre>
  
  <p>Some of the answers on SO e.g. <a href="https://stackoverflow.com/a/53204156/958580">Sergii Suvorov</a> provide the following alternative :</p>
  
  <pre><code>Log.i("fragments","Count : " + supportFragmentManager.findFragmentById(R.id.NAVIGATION)?.childFragmentManager?.fragments.toString())
  </code></pre>
  
  <p>Which simply returns null for me</p>
  
  <pre><code>... I/fragments: null
  </code></pre>
  
  <p>Within a <em>method</em> of a <em>fragment</em> I can call the following</p>
  
  <pre><code>Log.i("fragments", fragmentManager?.fragments.toString())
  </code></pre>
  
  <p>and it does return the desired result</p>
  
  <pre><code>... I/fragments: [FirstFragment{1475645 (3bb8566b-22b0-4c98-82ea-566e18915145) id=0x7f080001}]
  </code></pre>
  
  <p>I do not however see how to do this from the activity, perhaps some one out there knows the magic incantation ?</p>