title: Android (java) : Navigation icon instead back arrow in toolbar
body: <p>Currently my navigation icon that leads to my &quot;AppBarConfiguration&quot; disappears automatically as soon as I switch to the next fragment to leave a back arrow.
  How can I make sure that on all the following fragments, the navigation icon is displayed instead of this arrow?</p>
  <p>Thank you for your help!</p>
  <p><strong>toolbar fragment_home (first fragment with navigation icon)</strong></p>
  <p><a href="https://i.stack.imgur.com/JTOam.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p><strong>toolbar other fragment</strong></p>
  <p><a href="https://i.stack.imgur.com/2kDiU.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p><strong>MainActivty.java</strong></p>
  <pre><code>
  public class MainActivity extends AppCompatActivity {
      private AppBarConfiguration mAppBarConfiguration;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
  
          Toolbar toolbar = findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          DrawerLayout drawer = findViewById(R.id.drawer_layout);
          NavigationView navigationView = findViewById(R.id.nav_view);
  
  
          mAppBarConfiguration = new AppBarConfiguration.Builder(
                  R.id.homeFragment, R.id.personnalInformationsFragment)
                  .setDrawerLayout(drawer)
                  .build();
  
          NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
          NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
          NavigationUI.setupWithNavController(navigationView, navController);
  
  
          Objects.requireNonNull(getSupportActionBar()).setDisplayUseLogoEnabled(false);
      }
  
      @Override
      public boolean onSupportNavigateUp() {
          NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
          return NavigationUI.navigateUp(navController, mAppBarConfiguration)
                  || super.onSupportNavigateUp();
      }
  
      public void setToolBarTitle(String title){
          Objects.requireNonNull(getSupportActionBar()).setTitle(title);
      }
  }
  
  </code></pre>
  <p><strong>method that initializes the toolbar on each fragment</strong></p>
  <pre><code> @Override
      public void onResume() {
          ((MainActivity) requireActivity()).setToolBarTitle(getString(R.string.menu_home));
          super.onResume();
      }
  </code></pre>
  <p><strong>Activity_main.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.drawerlayout.widget.DrawerLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:id=&quot;@+id/drawer_layout&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:fitsSystemWindows=&quot;true&quot;
      tools:openDrawer=&quot;start&quot;&gt;
  
      &lt;include
          layout=&quot;@layout/main_app_bar&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot; /&gt;
  
      &lt;com.google.android.material.navigation.NavigationView
          android:id=&quot;@+id/nav_view&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_gravity=&quot;start&quot;
          android:fitsSystemWindows=&quot;true&quot;
          app:menu=&quot;@menu/activity_main_drawer&quot; /&gt;
  
  &lt;/androidx.drawerlayout.widget.DrawerLayout&gt;
  </code></pre>
  <p><strong>main_app_bar.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.ui.MainActivity&quot;&gt;
  
      &lt;com.google.android.material.appbar.AppBarLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;&gt;
  
          &lt;androidx.appcompat.widget.Toolbar
              android:id=&quot;@+id/toolbar&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;?attr/actionBarSize&quot;
              android:background=&quot;?attr/colorPrimary&quot; /&gt;
  
      &lt;/com.google.android.material.appbar.AppBarLayout&gt;
  
      &lt;include layout=&quot;@layout/main_content&quot; /&gt;
  
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>