title: OnClick Event for Navigation Drawer items
body: <p>I have a trouble with my app. I want to make an app that has <code>WebView</code> and will change the URL when I click one of the items on the navigation drawer. For example: 
  Facebook
  Twitter
  Github
  and so on. But I couldn't implement the <code>onClick</code> event. I am new in Android development. Thanks in advance.</p>
  
  <p>This is my Java File</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  private DrawerLayout mDrawerLayout;
  private ActionBarDrawerToggle mToggle;
  private Toolbar mToolBar;
  private WebView webView;
  
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      mToolBar = (Toolbar) findViewById(R.id.nav_action_bar);
      setSupportActionBar(mToolBar);
  
  
      mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
      mToggle = new ActionBarDrawerToggle(this,mDrawerLayout,R.string.open,R.string.close);
  
      mDrawerLayout.addDrawerListener(mToggle);
      mToggle.syncState();
  
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
  
      webView = (WebView) findViewById(R.id.webView);
      WebSettings webSettings = webView.getSettings();
      webSettings.setJavaScriptEnabled(true);
  
      webView.loadUrl("https://www.facebook.com/groups/276912206003690/");
      webView.setWebViewClient(new WebViewClient());
  
  
  
  
  }
  
  
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
  
  
      if (mToggle.onOptionsItemSelected(item)){
              return true;
      }
  
  
  
      return super.onOptionsItemSelected(item);
  }
  
  
  
  
  
  @Override
  public void onBackPressed() {
      if(webView.canGoBack()){
          webView.goBack();
      }else{
          super.onBackPressed();
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This my Main_activity.xml</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><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:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.tehedligmail.navigation_drawer.MainActivity"
      android:id="@+id/drawer_layout"&gt;
  
  
   &lt;LinearLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="vertical"&gt;
  
       &lt;include layout = "@layout/navigation_action_bar"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"/&gt;
  
       &lt;WebView
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:id="@+id/webView"&gt;
       &lt;/WebView&gt;
  
       
   &lt;/LinearLayout&gt;
  
      &lt;android.support.design.widget.NavigationView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:menu="@menu/navigation_menu"
          app:headerLayout="@layout/navigation_header"
          android:layout_gravity = "start"&gt;
      &lt;/android.support.design.widget.NavigationView&gt;
      
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is my Menu file menu.xml</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><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/settings"
          android:icon="@mipmap/ic_launcher"
          android:title="Settings" /&gt;
  
      &lt;item
          android:id="@+id/log_out"
          android:title="Log out"
          android:icon="@mipmap/ic_launcher"/&gt;
  
      &lt;item
          android:id="@+id/google"
          android:title="google"
          android:icon="@mipmap/ic_launcher"/&gt;
  
  &lt;/menu&gt;</code></pre>
  </div>
  </div>
  </p>