title: How to react to changes in back stack for fragments in android?
body: <p>Since <a href="https://developer.android.com/reference/android/support/v4/app/FragmentManager.OnBackStackChangedListener#onBackStackChanged()" rel="nofollow noreferrer">FragmentManager is deprecated</a> now below code gives me an error:</p>
  <pre><code>    getFragmentManager().addOnBackStackChangedListener(
          new FragmentManager.OnBackStackChangedListener() {
          public void onBackStackChanged() {
              // whenever back stack changes, the code here runs
          }
      }
  );  
  </code></pre>
  <p>What is the new way to listen to whenever the contents of the back stack change ?</p>