title: Getting Error when I called the menu view
body: <p>I'd like to get the menu view but I get this error:</p>
  
  <blockquote>
    <p>Attempt to invoke virtual method 'android.view.View
    android.view.View.findViewById(int)' on a null object reference</p>
  </blockquote>
  
  <p>Any help please..</p>
  
  <p><strong>Activity</strong>:</p>
  
  <pre><code> @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.menu_action_bar, menu);
      View view2 = menu.findItem(R.id.cart_menu).getActionView();
      badge = (NotificationBadge)view2.findViewById(R.id.badge);
      cart_icon = (ImageView)view2.findViewById(R.id.cart_icon);
  
      cart_icon.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Toast.makeText(HomeActivity.this, "Test", Toast.LENGTH_SHORT).show();
          }
      });
  
      myFunction();
      return true;
  }
  </code></pre>
  
  <p><strong>menu_action_bar.xml</strong></p>
  
  <pre><code>&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/cart_menu"
      android:icon="@drawable/ic_shopping_cart_black_24dp"
      android:title="Panier"
      app:showAsAction="always"
      android:actionLayout="@layout/action_bar_notification_icon" /&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>action_bar_notification.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  style="@android:style/Widget.ActionButton"&gt;
  
  &lt;ImageView
      android:id="@+id/cart_icon"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/ic_shopping_cart_black_24dp"/&gt;
  
  &lt;com.nex3z.notificationbadge.NotificationBadge
      android:id="@+id/badge"
      android:layout_width="28dp"
      android:layout_height="28dp"
      android:layout_toRightOf="@+id/cart_icon"
      android:layout_alignParentTop="@+id/cart_icon"
      android:layout_marginLeft="-10dp"
      android:layout_marginTop="-10dp"
      app:nbMaxTextLength="2"
  
      /&gt;
  </code></pre>
  
  <p></p>