title: Search Bar for a seperate fragment
body: <p>I have made different fragments inside one Activity (Home.java) on which toolbar and navigation drawer is there.<br>
  Right now I thought to put searchview inside fragment.We usually write all code related to searchview inside oncreateoption menu. I have done the same thing but oncreateoption  is made inside fragment.</p>
  
  <p>I'm not getting any error but searchbar is not be shown over the toolbar.</p>
  
  <pre><code>package com.example.foody;
  
  
  import android.database.Cursor;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.support.v7.widget.SearchView;
  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 java.util.ArrayList;
  
  public class fitem extends Fragment implements SearchView.OnQueryTextListener
  {
      RecyclerView rv1;
      fitemAdapter adapter;
      ArrayList&lt;All_Data&gt; item;
      Cursor cr;
      Storage sob;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
      {
          View v=inflater.inflate(R.layout.fragment_fitem, container, false);
          sob=new Storage(getContext());
  
          Bundle bundle = this.getArguments();
          if (bundle == null)
              cr=sob.allData();                           //if called from home page
          else
              cr=sob.categorisedData(bundle.getString("category"));      // if called from category page
          inData();
  
          rv1=v.findViewById(R.id.rv1);
          rv1.setHasFixedSize(true);
          rv1.setLayoutManager(new LinearLayoutManager(getContext()));
          adapter=new fitemAdapter(getContext(),item);
          rv1.setAdapter(adapter);
          return v;
      }
  
      void inData()
      {
          item=new ArrayList&lt;&gt;();
          while(cr.moveToNext())
          {
              item.add(new All_Data(cr.getString(0),cr.getString(2),cr.getString(3)));
          }
      }
  
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
      {
          super.onCreateOptionsMenu(menu, inflater);
          inflater.inflate(R.menu.tool_menu, menu);
          MenuItem searchItem = menu.findItem(R.id.search1);
          SearchView searchView = (SearchView) searchItem.getActionView();
          searchView.setOnQueryTextListener(fitem.this);
          searchView.setQueryHint("Search");
      }
  
  
      @Override
      public boolean onQueryTextChange(String s)
      {
          String userInput=s.toLowerCase();
          ArrayList&lt;All_Data&gt; filterlist=new ArrayList&lt;&gt;();
          for(int i=0;i&lt;item.size();i++)
          {
              String st=item.get(i).getName().toLowerCase();
              if(st.contains(userInput))
                  filterlist.add(item.get(i));
          }
          adapter=new fitemAdapter(getContext(),filterlist);
          rv1.setAdapter(adapter);
          return true;
      }
  
      @Override
      public boolean onQueryTextSubmit(String s) {
          return false;
      }
  
  }
  
  </code></pre>