1

I need to hide one view of parent fragment from child fragment.

I have one MainActivity which have container which loads four fragments in first fragment there is another container for Tabwidget which loads four fragments.Inside fragment I have RecyclerView which loads different item .On click of item there is load of other fragment.For this I have to hide the Tabwidget and show whenever press back.

I have searched lots for this scenario but not get success.

Please advise what to do?

Thanks

Apurva Kolapkar
  • 1,270
  • 2
  • 16
  • 32

1 Answers1

1

I need to hide one view of parent fragment from child fragment.

Create public method in Parent Fragment

public void hideView() {
   // Handle your hiding code
}

To call this method from Child Fragment

((YourParentFragmentCLASS) getParentFragment()).hideView(); // getParentFragment() will return parent fragment of current child fragment
Paresh P.
  • 6,677
  • 1
  • 14
  • 26