Android Get switch from ActionLayout on Navigation Drawer
<p>How do I specifically get the switch from my actionLayout (that is a menu item) so I can set the 'setOnCheckedChangeListener' event?</p>

<p>Here is my menu for the navigation drawer:</p>

<pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"&gt;

        &lt;item android:id="@+id/nav_switch"
            app:actionLayout="@layout/action_view_switch"
            android:title="One-to-one mode" /&gt;
&lt;/menu&gt;
</code></pre>

<p>With the action_view_switch actionlayout:</p>



<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;

    &lt;Switch
        android:id="@+id/otoSwitch"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>And finally, my navigation drawer:</p>

<pre><code>&lt;android.support.design.widget.NavigationView
        android:id="@+id/nvView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@android:color/white"
        app:menu="@menu/drawer_view"
        app:headerLayout="@layout/nav_header"/&gt;
</code></pre>

<p>I understand that I can do something like: </p>

<pre><code>Menu menu = navigationView.getMenu();
MenuItem menuItem = menu.findItem(R.id.nav_switch);
View actionView = MenuItemCompat.getActionView(menuItem);
actionView.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {

  }
});
</code></pre>

<p>But this does not give me any states such as isChecked like 'setOnCheckedChangeListener' would.  How do I get the switch view so I can set its listeners?</p>