title: I want to add search property in my fragment
body: <p>I am  new to android, I want to add a search property to my fragment and I did the below code, I've run it, and it shows no errors in the logcat, but it not showing the Search icon, though I set the "action_bar" thing to the toolbar in my fragment(Please refer code).
  Please help me.
  your help is highly appreciated.</p>
  
  <pre><code>package com.example.myapplication;
  
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.SearchView;
  import android.support.v7.widget.Toolbar;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  
  
  public class CategoryFragment extends Fragment {
  private Toolbar toolbar;
   ListView listView;
   ArrayAdapter mAdapter;
   SearchView searchView;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
      View v= inflater.inflate(R.layout.fragment_category, container, false);
      listView=v.findViewById(R.id.list);
      toolbar=v.findViewById(R.id.tool);
      ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
      searchView=v.findViewById(R.id.item_search);
  
      return v;
  }
  
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  
  
      toolbar.setTitle("Category");
  
      mAdapter = new ArrayAdapter&lt;String&gt;(getContext(),
              android.R.layout.simple_list_item_1,
              getResources().getStringArray(R.array.category));
      listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
              Intent intent = new Intent(getContext(), cate_list.class);
              intent.putExtra("SongName", listView.getItemAtPosition(i).toString());
              startActivity(intent);
          }
      });
      listView.setAdapter(mAdapter);
  }
  
  @Override
  public void onCreateOptionsMenu(Menu menu,MenuInflater inflater) {
      super.onCreateOptionsMenu(menu, inflater);
      inflater.inflate(R.menu.menu, menu);
      MenuItem mSearch = menu.findItem(R.id.item_search);
      SearchView mSearchView = (SearchView) mSearch.getActionView();
      mSearchView.setQueryHint("Search your lyrics");
      mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
              return false;
          }
          @Override
          public boolean onQueryTextChange(String newText) {
              mAdapter.getFilter().filter(newText);
              return true;
          }
      });
  }
  }
  </code></pre>