title: Android toolbar navigation with Close and Arrow button
body: <p>I want to make a toolbar navigation like this.</p>
  
  <p>When I create my activity, I inflate a fragment and draw a close button on my toolbar. But, if user opens another fragment, shows the back arrow... But on this source, it only shows close button.</p>
  
  <p>Here is my <code>onCreate()</code> method.</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_initial);
  
      setSupportActionBar(mToolbar);
  
      if (getSupportActionBar() != null) {
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white);
      }
  
      getSupportFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
          @Override
          public void onBackStackChanged() {
              int stackHeight = getSupportFragmentManager().getBackStackEntryCount();
              if (stackHeight &gt; 0) {
                  if (getSupportActionBar() != null) {
                      getSupportActionBar().setHomeButtonEnabled(true);
                      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                  }
              } else {
                  if (getSupportActionBar() != null) {
                      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                      getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white);
                  }
              }
          }
      });
  
      if (findViewById(R.id.container_initial) != null) {
          if (savedInstanceState != null) {
              return;
          }
  
          ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), new LoginFragment(), R.id.container_initial);
      }
  }
  </code></pre>
  
  <p>If i remove this code, work the part of back arrow button, but dont show the close button...</p>
  
  <pre><code>        if (getSupportActionBar() != null) {
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white);
      }
  </code></pre>