title: bottomNavigationView.setSelectedItemId is not working on create/start when "don't keep activities" turn on
body: <p>I am using <code>bottomNavigationView.setSelectedItemId</code>. I have tried putting it in onCreate and onStart. It works for the most part but it fails to actually display the bottom tab as selected, if &quot;don't keep activities&quot; is turned on in developer options and I exit out of the app and re-enter it.</p>
  <p>Update: I even tried this with example boilerplate code from <a href="https://androidwave.com/bottom-navigation-bar-android-example/" rel="nofollow noreferrer">https://androidwave.com/bottom-navigation-bar-android-example/</a> and it still failed</p>
  <p>Example:</p>
  <pre><code>  @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      bottomNavigation = findViewById(R.id.bottom_navigation);
      bottomNavigation.setOnNavigationItemSelectedListener(navigationItemSelectedListener);
      bottomNavigation.setSelectedItemId(bottomNavigation.getMenu().getItem(0).getItemId());
      openFragment(HomeFragment.newInstance(&quot;&quot;, &quot;&quot;));
    }
  </code></pre>
  <p>The fragment displayed switches back to the home fragment, but the displayed &quot;selected&quot; tab is still the previous one. This only happens if &quot;don't keep activities&quot; is turned on.</p>