title: adapter.getFilter().filter(newText) is not working in Activity but working properly in Fragment
body: <p>Fragment_Adapter_Calling.java file</p>
  <pre><code>MyStudentAdapterU adp = new MyStudentAdapterU(stuData, getContext());
  stdRecyclerView.setAdapter(adp);
  stdRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  
   @Override
  public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
  
  
  
      inflater.inflate(R.menu.search_menu,menu);
  
      MenuItem item=menu.findItem(R.id.search_menu);
  
      SearchView searchView=(SearchView)item.getActionView();
      searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
              return false;
          }
  
          @Override
          public boolean onQueryTextChange(String newText) {
  
              adp.getFilter().filter(newText);
  
              return false;
          }
      });
  
      super.onCreateOptionsMenu(menu, inflater);
  }
  </code></pre>
  <p>but when I try to paste the same code in Activity.java file to call adapter, It shows an error &quot;Cannot resolve method 'getFilter' in 'ProviderAdapter' on
  adapter.getFilter.filter(newText) line;</p>
  <pre><code>ProviderAdapter adp=new ProviderAdapter(ProviderActivityList.this,lists);
   r1.setAdapter(adp);
   r1.setLayoutManager(new LinearLayoutManager(ProviderActivityList.this));
  
     @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.search_menu,menu);
  
      MenuItem item=menu.findItem(R.id.search_menu);
  
      SearchView searchView=(SearchView)item.getActionView();
      searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
              return false;
          }
  
          @Override
          public boolean onQueryTextChange(String newText) {
  
              adp.getFilter().filter(newText);
  
  
              return false;
          }
      });
      return super.onCreateOptionsMenu(menu);
  }
  </code></pre>
  <p>Error picture
  <a href="https://i.stack.imgur.com/H4dBG.png" rel="nofollow noreferrer">Error Screenshot</a></p>