I have an Activity that creates a Fragment and then this Fragment creates another Fragment:
Activity -> Fragment1 -> Fragment2
I am now in Fragment2 and I'd like to go back to Fragment1 by clicking on a button.
In my OnClickListener of my button I have:
getActivity().getSupportFragmentManager().beginTransaction().remove(fragment2.this).commit();
This brings me to the Activity. Is there actually a way to just remove Fragment2 and go to Fragment1?
Thank you in advance for your time, I could not find any suitable info online!