public void setLoading ( boolean isLoading ) { getSupportFragmentManager ( ) . beginTransaction ( ) . replace ( R . id . root , isLoading ? loadingFragment : formFragment ) . commit ( ) ; }
Swap between showing the form and loading fragments