title: how to use Buttons on action bar With Fragments?
body: <p>i want to add button on the actionbar of a fragment.But i'm getting error on this code given below. </p>
  
  <p>this is my Fragment code where i want to add button on actionbar of this tab</p>
  
  <pre><code>@Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
           final View view = inflater.inflate(R.layout.credit_main, container, false);
  return view;
      }
  @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu items for use in the action bar
          MenuInflater inflater = getMenuInflater();
  
          inflater.inflate(R.menu.search_menu, menu);
          return super.onCreateOptionsMenu(menu);
      }
  
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
              // action with ID action_refresh was selected
              case R.id.search:
                  Toast.makeText(getActivity(), "Refresh selected", Toast.LENGTH_SHORT)
                          .show();
                  break;
              default:
                  break;
          }
          return super.onOptionsItemSelected(item);
      }
  
  }
  </code></pre>
  
  <p>here error is <code>getMenuInflater();</code> cannot resolve </p>