title: how to hide "fab" button for a specific fragment activity?
body: <p>How do I hide &quot;fab&quot; button, when clicked or opened a specific fragment?</p>
  <p>I want to hide From bellow fragment:</p>
  <pre><code>public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          View newExchange= inflater.inflate(R.layout.new_exchange,container,false);
  
  
          recyclerView=newExchange.findViewById(R.id.step1recycleView);
          datalist=new ArrayList&lt;&gt;();
          exchangeAdapter=new NewExchangeAdapter(datalist,getContext());
          recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
          recyclerView.setAdapter(exchangeAdapter);
          loadData();
  
          FloatingActionButton fab =newExchange.findViewById(R.id.fab);
          fab.setVisibility(View.INVISIBLE);//this is generating error on setVisibility
  
          return newExchange;
  
  
  
  
      }
  </code></pre>
  <p>Here I set fab button on click</p>
  <pre><code>fab.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                 // Snackbar.make(view, &quot;Replace with your own action&quot;, Snackbar.LENGTH_LONG)
                   //       .setAction(&quot;Action&quot;, null).show();
  
                  fragment=new NewExchangeFrag();
                  getSupportFragmentManager().beginTransaction().replace(R.id.frame,fragment).commit();
                  fab.setVisibility(view.INVISIBLE);//This way also generating error on setVisibility
  </code></pre>
  <p>Also I tried to use <code>fab.hide();</code> and this is crashing my application</p>
  <p>What is correct way?</p>