title: void android.support.v7.widget.SearchView.setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener)
body: <p>I am doing SearchView on CustomAdapter where it will search Gate Name. After i try run the app, it suddenly crash and give me the error as stated above. I do not know which part did i even do wrong that cause this issue to appear everytime i try to run my app.</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(Menu menu) {
  
      getMenuInflater().inflate(R.menu.main_menu, menu);
  
      MenuItem searchItem = menu.findItem(R.id.item_search);
      SearchView searchView = (SearchView) searchItem.getActionView();
  
      searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
              return false;
          }
  
          @Override
          public boolean onQueryTextChange(String newText) {
              List&lt;Gate&gt; gateSearchList = new ArrayList&lt;Gate&gt;();
  
              for (Gate gate : gateList) {
                  if (gate.getGateName().toLowerCase().contains(newText.toLowerCase())) {
                      gateSearchList.add(gate);
                  }
              }
  
              adapter = new GateAdapter(MainActivity.this, gateSearchList);
              lv.setAdapter(adapter);
              return true;
          }
      });
  
      return super.onCreateOptionsMenu(menu);
  }
   @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      if (item.getItemId() == R.id.action_logout) {
          logout();
      }
      return super.onOptionsItemSelected(item);
  }
  </code></pre>
  
  <p>main_menu.xml</p>
  
  <pre><code> &lt;item
      android:id="@+id/item_search"
      android:icon="@drawable/ic_action_search"
      android:actionViewClass="android.support.v7.widget.SearchView"
      app:showAsAction="ifRoom|collapseActionView"
      android:title="Search"&gt;
  
  &lt;/item&gt;
  &lt;item android:id="@+id/action_logout"
      android:title="Log Out"
      app:showAsAction="never"/&gt;
  </code></pre>
  
  <p>This is the error message in logcat:</p>
  
  <blockquote>
    <p>java.lang.NullPointerException: Attempt to invoke virtual method 'void
    android.support.v7.widget.SearchView.setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener)'
    on a null object reference</p>
  </blockquote>
  
  <p>It also indicate that the error also came from this line of code:</p>
  
  <pre><code>searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
  </code></pre>
  
  <p>I hope someone can be able to provide me the solution to solve my issue. </p>