I have an Activity that contains two fragments beside each other. One of the fragment is a List Fragment and the other one contains surface view for a video.
I've implemented a custom controller to make the video in full screen but when the full screen button is pressed the list fragment still exist. How can i show/hide the list fragment when the toggle full screen button on the video fragment is pressed?
Asked
Active
Viewed 255 times
2

user1673892
- 409
- 2
- 5
- 17
1 Answers
0
If the event of video's full screen occurs inside fragment then you can write an interface which will be implemented by parent activity hosting the two fragments. The interface will contain a function that will be called after you make the video full screen. On the function's implementation in Activity remove the list fragment using FragmentManager and FragmentTransaction class. You can remove listFragment fragment like this;
FragmentManager fragmentManager = getFragmentManager()
Or:
FragmentManager fragmentManager = getSupportFragmentManager();
Then;
fragmentManager.beginTransaction().remove(listFragment).commit();
Similarly, when full screen mode is off then you can add this fragment back the same way using add() function instead of remove().

Mohsin Hussain Butt
- 21
- 6