title: 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference & <item element should not be here
body: <p>I'm trying to define a button in my <code>Home</code> activity to open my <code>Settings</code> activity but I get the error :</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Unable to start activity
    ComponentInfo{com.example.padmw/com.example.padmw.Home}:
    java.lang.NullPointerException: Attempt to invoke virtual method 'void
    android.widget.Button.setOnClickListener(android.view.View$OnClickListener)'
    on a null object reference</p>
  </blockquote>
  
  <p>My layout for the Settings item is in <code>res/menu</code>, I tried moving it to <code>res/layout</code> but then it says that element item should not be there. What should i do?</p>
  
  <p>My Button in Home.class:</p>
  
  <pre><code>    Button mButton = (Button) findViewById(R.id.action_settings);
      mButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              startActivity(new Intent(Home.this, SettingsActivity.class));
          }
      });
  </code></pre>
  
  <p>My item in res/home.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &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/action_settings"
          android:orderInCategory="100"
          android:title="@string/action_settings"
          app:showAsAction="never" /&gt;
  &lt;/menu&gt;
  </code></pre>