0

I am working on a project with only one activity, my activity has fragment container to swap between different fragments and thats it. I have like 15-20 fragments in the project and I want to be able have a back button between some of the fragments. As I do only have one activity and I have NoActionBar I was wondering if there is a way to have an up/back button between fragments. I have researched but not found an awnser.

Thanks in advance.

Mohammed
  • 195
  • 1
  • 3
  • 12

1 Answers1

0

Try use the following inside the onclick() of the back button: getActivity().onBackPressed();

This question has also been answered here:Fragment pressing back button. Check that link for more insights.

Fredrick
  • 11
  • 2