title: Navigation drawer, listen to item clicked events
body: <p>I have this menu layout "navigation_menu.xml":   </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;item
          android:id="@+id/item1"
          android:title="@string/item1"/&gt;
  
      &lt;item
          android:id="@+id/item2"
          android:title="@string/item2"/&gt;
  
      &lt;item
          android:id="@+id/item3"
          android:title="@string/item3"/&gt;
  
  &lt;/menu&gt;
  </code></pre>
  
  <p>My main activity layout "activity_main.xml" is this:</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout
      android:id="@+id/drawer_layout"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      tools:context=".MainActivity"&gt;
  
      &lt;android.support.design.widget.NavigationView
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          app:menu="@menu/navigation_menu"
          android:layout_gravity="start"&gt;
  
  
      &lt;/android.support.design.widget.NavigationView&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>And this is the Java code of the main activity where I initialize the drawer:</p>
  
  <pre><code>private DrawerLayout drawer_layout;
  private ActionBarDrawerToggle toggle;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // ...
      drawer_layout = (DrawerLayout)findViewById(R.id.drawer_layout);
      toggle = new ActionBarDrawerToggle(this, drawer_layout, R
              .string.open_drawer, R.string.close_drawer);
      drawer_layout.addDrawerListener(toggle);
      toggle.syncState();
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      // ...
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      if (toggle.onOptionsItemSelected(item)) {
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  </code></pre>
  
  <p>The drawer opens and closes correctly, but <strong>I don't know how to do something when an item is clicked</strong>, for example showing a log.</p>
  
  <p>Does anyone know?</p>
  
  <p>Thanks</p>