I am using this to launch a new fragment depending on the screen size of the device.
FragmentManager fragMgr = getSupportFragmentManager();
releaseInfoFragment release = (releaseInfoFragment)fragMgr.findFragmentById(R.id.release);
release = releaseInfoFragment.newInstance(url);
FragmentTransaction xaction = fragMgr.beginTransaction();
xaction.replace(R.id.release, release)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.addToBackStack(null)
.commit();
}
The problem is when the user presses the back press button, the it goes back to each fragment that was opened during the activities life cycle. How can i make it where it doesnt do this? I just want it to remove the fragment once its pressed the first time, and then go back to the following activity on the second click.
How do i go about doing this?