code: private void addFragmentToView(final int viewId, final Fragment fragment) {
      fragmentManager.beginTransaction().replace(viewId, fragment).commit();
    }
docs: Use FragmentManager to attach one fragment to one view using the viewId.
  
  @param viewId used to obtain the view.
  @param fragment to be attached.