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