title: Android - add icon in actionbar
body: <p>I need to add an icon at the top right of the menu in the <code>ActionBar</code> when an item is selected from the <code>NavigationDrawer</code> menu.</p>
  
  <p>So I have create a new file called for example '<code>blog</code>' that extends <code>Fragment</code> and I have write in it the <code>onCreateOptionsMenu</code> method that should manage the menu action bar right?</p>
  
  <p>This is my code:</p>
  
  <pre><code>import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class Blog extends Fragment {
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.blog, container, false);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu items for use in the action bar
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.blog_menu, menu);
          return super.onCreateOptionsMenu(menu);
      }
  }
  </code></pre>
  
  <p>Android studio write in red this line of code:</p>
  
  <pre><code>MenuInflater inflater = getMenuInflater();
  </code></pre>
  
  <p>so I think that it is wrong but I do not understand what is the problem...any help?</p>