title: Abstract Nav Drawer Android
body: <p>I'm trying to abstract my Navigation Drawer to streamline my Android app but I'm running into some issues. The Nav Drawer simply doesn't respond to touches, I can't figure out why.</p>
  
  <p>MainActivity.kt</p>
  
  <pre><code>class MainActivity : NavActivity() {
  /** ON CREATE **/
  override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_main)
         main_seekbar_price!!.setOnSeekBarChangeListener(this)
         mDrawerLayout = findViewById(R.id.drawer_layout) // Variable in superclass
  ...
  </code></pre>
  
  <p>NavDrawer.kt</p>
  
  <pre><code>abstract class NavActivity : BaseActivity() {
  
  /** Variables **/
  lateinit var mDrawerLayout: DrawerLayout
  
  
  /** ON CREATE **/
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_nav)
  
      // Set Nav Drawer listener
      nav_view.setNavigationItemSelectedListener { menuItem -&gt;
          Log.d("NAV", "nav selected listener header")
          menuItem.isChecked = true
          mDrawerLayout.closeDrawers()
          navMenuSwitch(menuItem)
          true
      }
  
      // Set Nav Footer listener
      nav_footer.setNavigationItemSelectedListener { menuItem -&gt;
          Log.d("NAV", "nav selected listener footer")
          menuItem.isChecked = false
          mDrawerLayout.closeDrawers()
          navMenuSwitch(menuItem)
          true
      }
  }
  ...
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/colorBackground"
      android:fitsSystemWindows="true"
      tools:context=".MainActivity"&gt;
  
      &lt;FrameLayout
          android:id="@+id/content_frame"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
  
      ...
  
      &lt;/FrameLayout&gt;
  
      &lt;include layout="@layout/activity_nav" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>activity_nav.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.NavigationView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/nav_view"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:fitsSystemWindows="true"
      app:menu="@menu/drawer_header"
      app:headerLayout="@layout/nav_header"&gt;
  
      &lt;android.support.design.widget.NavigationView
          android:id="@+id/nav_footer"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="bottom"
          app:menu="@menu/drawer_footer"&gt;
      &lt;/android.support.design.widget.NavigationView&gt;
  
  &lt;/android.support.design.widget.NavigationView&gt;
  </code></pre>
  
  <p>I thought it has something to do with assigning mDrawerLayout in the child class but that didn't fix anything. It never calls the listeners though, no matter how much you click it it won't even print Logs in that listener.</p>
  
  <p>Any help is welcome as I can't figure this out for the life of me, thank you in advance!</p>