The implementation of onTabSelected() uses the instance variable
mFragmentTransaction, which is hand over to the listeners
onTabSelected(). At the start of an Activity, which uses a TabListener
a NullPointerException is thrown, because the FragmentTransaction is
null. The only point where a FragmentTransaction is assigned to
mFragmentTransaction is onTabUnselected().
I guess the intended behavior is that the transaction created in
onTabUnselected() is used in onTabSelected() afterwards and the
detaching/attaching is done in the same transaction (because
onTabUnselected() doesn't call commit on the transaction itself).
However at the start just onTabSelected() is called and not
onTabUnselected(), because there was nothing selected before. So
mFragmentTransaction is null and the Exception is thrown. I added an
if-check to receive the FragmentTransaction the same way
onTabUnselected() does, when mFragmentTransaction is null.