title: Action Bar Drawer Toggle displayed on AppBar but not working?
body: <p>I created a class called BaseActivity that all of the activities inherit from so that I can add the drawer layout in all of my activities.</p>
  <p>The Drawer Toggle button is shown in the AppBar, but when I click on it nothing happens!</p>
  <p>Here is the code for the BaseActivity.kt:</p>
  <pre><code>open class BaseActivity : AppCompatActivity() {
  
  private var dl: DrawerLayout? = null
  private var t: ActionBarDrawerToggle? = null
  private var nv: NavigationView? = null
  
    override fun onCreate(savedInstanceState: Bundle?) {
     super.onCreate(savedInstanceState)
       setContentView(R.layout.base_activity)
       dl = findViewById(R.id.drawer_layout)
       t = ActionBarDrawerToggle(this, dl,  R.string.drawer_open, R.string.drawer_close)
        supportActionBar?.setDisplayShowTitleEnabled(true);
        supportActionBar?.setHomeButtonEnabled(true);
        supportActionBar?.setDisplayHomeAsUpEnabled(true);
       dl?.addDrawerListener(t!!)
       t?.syncState()
  
       nv = findViewById(R.id.navigation_view)
      nv?.setNavigationItemSelectedListener(NavigationView.OnNavigationItemSelectedListener { item -&gt;
          when (item.itemId) {
              R.id.nav_note -&gt; Toast.makeText(this@BaseActivity, &quot;My Account&quot;, Toast.LENGTH_SHORT).show()
              R.id.nav_calendar -&gt; Toast.makeText(this@BaseActivity, &quot;Settings&quot;, Toast.LENGTH_SHORT).show()
              R.id.nav_trash -&gt; Toast.makeText(this@BaseActivity, &quot;Trash&quot;, Toast.LENGTH_SHORT).show()
              else -&gt; return@OnNavigationItemSelectedListener true
          }
          true
      })
  }
  override fun onOptionsItemSelected(item: MenuItem): Boolean {
      return if (t?.onOptionsItemSelected(item) == true) {
          true
      } else super.onOptionsItemSelected(item!!)
  }
  </code></pre>
  <p>}</p>
  <p>and here the base_activity.xml:</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;
  tools:context=&quot;.BaseActivity&quot;&gt;
  &lt;!--include layout=&quot;@layout/toolbar&quot;/--&gt;
  
  &lt;com.google.android.material.navigation.NavigationView
      android:id=&quot;@+id/navigation_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/drawer_menu&quot;
      app:headerLayout=&quot;@layout/nav_header&quot;/&gt;
  
  &lt;/androidx.drawerlayout.widget.DrawerLayout&gt;
  </code></pre>
  <p>For the style I left it at DarkActionBar. Here is how it looks like <a href="https://i.stack.imgur.com/oh0F1.jpg" rel="nofollow noreferrer">Don't mind what's written there</a></p>
  <p>I still cannot figure out what's wrong and why it doesn't work. I appreciate any suggestions from the community. Thank you.</p>