Create the fragment in the activity, not the listener.
Put the fragments into a container rather than at the top level.
Refactored tab creation to its own function.