Hey all I have 3 fragments - activity_main, _fragmoviesand _fragvideoplay.
In the activity_main I have the following:
In my _fragmovies I have the following:
In my _fragvideoplay I have the following:
On the activity_main I have the videoFrame that loads the _fragmovies fragment inside it when it's called by the _fragmovies.
public void startVideo(String mp4Name) {
tabLayout = (TabLayout) findViewById(R.id.mTabLayout);
tabLayout.setVisibility(View.GONE);
myfragment = new videoPlay();
//pass data
Bundle bundle = new Bundle();
bundle.putString("KEY", mp4Name);
myfragment.setArguments(bundle);
fragmentManager = getSupportFragmentManager().beginTransaction();
fragmentManager.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
frameLayout = findViewById(R.id.videoFrame);
frameLayout.setVisibility(View.VISIBLE);
fragmentManager.replace(R.id.videoFrame, myfragment).commit();
}
The _fragmovies has a temporary button that, when pushed, loads up the _fragvideoplay fragment into the main_activity (the function above) along with passing the name of the video for _fragvideoplay to load up.
MainActivity ma = (MainActivity)getActivity();
ma.startVideo("thelostegg");
My question is:
What is the proper way to close the _fragvideoplay from within the _fragvideoplay function which is preformed by clicking on the close FloatingActionButton?
closeVid.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View v) {
if (floatingBtnMenu.isOpened()) {
_stop();
getActivity().getFragmentManager().popBackStack();
}
}
});
I tried using the getActivity().getFragmentManager().popBackStack(); but that does not seem to get rid of the _fragvideoplay so that I am able to see the _fragmoviesfragment page again (The one with the button on it).
In the activity_main I have the following:
In my _fragmovies I have the following:
In my _fragvideoplay I have the following:
On the activity_main I have the videoFrame that loads the _fragmovies fragment inside it when it's called by the _fragmovies.
public void startVideo(String mp4Name) {
tabLayout = (TabLayout) findViewById(R.id.mTabLayout);
tabLayout.setVisibility(View.GONE);
myfragment = new videoPlay();
//pass data
Bundle bundle = new Bundle();
bundle.putString("KEY", mp4Name);
myfragment.setArguments(bundle);
fragmentManager = getSupportFragmentManager().beginTransaction();
fragmentManager.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
frameLayout = findViewById(R.id.videoFrame);
frameLayout.setVisibility(View.VISIBLE);
fragmentManager.replace(R.id.videoFrame, myfragment).commit();
}
The _fragmovies has a temporary button that, when pushed, loads up the _fragvideoplay fragment into the main_activity (the function above) along with passing the name of the video for _fragvideoplay to load up.
MainActivity ma = (MainActivity)getActivity();
ma.startVideo("thelostegg");
My question is:
What is the proper way to close the _fragvideoplay from within the _fragvideoplay function which is preformed by clicking on the close FloatingActionButton?
closeVid.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View v) {
if (floatingBtnMenu.isOpened()) {
_stop();
getActivity().getFragmentManager().popBackStack();
}
}
});
I tried using the getActivity().getFragmentManager().popBackStack(); but that does not seem to get rid of the _fragvideoplay so that I am able to see the _fragmoviesfragment page again (The one with the button on it).