title: Android overflow menu nullPointerException when clicking three dots
body: <p>The normal button works fine, but clicking the three dots button makes an exception</p>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.main_menu, menu);
      return true;
  }
  </code></pre>
  
  <p>my xml file</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"
      xmlns:tools="http://schemas.android.com/tools"
      tools:context=".MainActivity"&gt;
  
  
      &lt;item
          android:icon="@drawable/refresh"
          android:id="@+id/action_main_refresh"
          app:showAsAction="always"
          android:title="@string/refresh" /&gt;
  
      &lt;item
          android:id="@+id/action_main_search"
          android:title="@string/search"
          android:icon="@drawable/seach"
          app:showAsAction="always"/&gt;
  
      &lt;item
          android:id="@+id/action_main_top"
          android:title="@string/sort_top"
          app:showAsAction="never" /&gt;
  
  
  &lt;/menu&gt;
  </code></pre>
  
  <p>Logs </p>
  
  <pre><code>06-22 23:12:49.481 1289-1289/? E/AndroidRuntime: FATAL EXCEPTION: main
                                               java.lang.NullPointerException
                                                   at android.support.v7.view.menu.ListMenuItemView.setTitle(ListMenuItemView.java:127)
                                                   at android.support.v7.view.menu.ListMenuItemView.initialize(ListMenuItemView.java:113)
                                                   at android.support.v7.view.menu.MenuAdapter.getView(MenuAdapter.java:100)
                                                   at android.support.v7.view.menu.MenuPopup.measureIndividualMenuWidth(MenuPopup.java:160)
                                                   at android.support.v7.view.menu.StandardMenuPopup.tryShow(StandardMenuPopup.java:153)
                                                   at android.support.v7.view.menu.StandardMenuPopup.show(StandardMenuPopup.java:187)
                                                   at android.support.v7.view.menu.MenuPopupHelper.showPopup(MenuPopupHelper.java:290)
                                                   at android.support.v7.view.menu.MenuPopupHelper.tryShow(MenuPopupHelper.java:175)
                                                   at android.support.v7.widget.ActionMenuPresenter$OpenOverflowRunnable.run(ActionMenuPresenter.java:803)
                                                   at android.os.Handler.handleCallback(Handler.java:730)
                                                   at android.os.Handler.dispatchMessage(Handler.java:92)
                                                   at android.os.Looper.loop(Looper.java:137)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5103)
                                                   at java.lang.reflect.Method.invokeNative(Native Method)
                                                   at java.lang.reflect.Method.invoke(Method.java:525)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                   at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>click listener</p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
      //Log.i(TAG, "sort URL: " + makeUrlCustom(item.getItemId()));
      switch(item.getItemId()){
          case R.id.action_main_refresh:
              if(!adapter.isEmpty()) adapter.clear();
              noData.setVisibility(View.GONE);
              get(url, null);
              return true;
          case R.id.action_main_search:
              AlertDialog.Builder alert = new AlertDialog.Builder(this);
  
              final EditText dialogText = new EditText(this);
  
              alert.setView(dialogText);
              alert.setTitle("Search subreddit");
  
              alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                      url = dialogText.getText().toString();
                      if(!adapter.isEmpty()) adapter.clear();
                      noData.setVisibility(View.GONE);
                      Log.i(TAG, "url from searchText is: " + url);
                      if(url.equals("") || url == null){
                          Toast.makeText(MainActivity.this, "Please insert valid subreddit", Toast.LENGTH_SHORT).show();
                      }else{
                          get(url, null);
                      }
                  }
              });
  
              // create alert dialog
              AlertDialog alertDialog = alert.create();
              // show it
              alertDialog.show();
              return true;
          case R.id.action_main_top:
              Log.i(TAG, "sort top");
              return true;
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>clicking on the menu overflow causes npe (in this case, the action_main_top).<br>
  clicking on the normal menu (refresh &amp; search) works fine.</p>