title: Adding a view to a fragment from another fragment
body: <p>I'm trying to add a view in fragment B from fragment A, they both belong to the same activity but they are never running simultaneously</p>
  
  <p><strong>My activity:</strong></p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      fm = getSupportFragmentManager();
      Fragment_Main main = new Fragment_Main();
      fm.beginTransaction()
              .replace(R.id.mainContainer, main)
              .commit();
  
    /* Fragment_Main is a fragment with two buttons
    *  to either call fragment A or fragment B and
    *  mainContainer is a FrameLayout occupying the whole screen
    */
  }
  </code></pre>
  
  <p><strong>Fragment A:</strong></p>
  
  <pre><code>@Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.fragment_subjects, container, false);
      ButterKnife.bind(this, view);
  
      AddButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              FragmentB.addMyView();
          }
      });
  
      return view;
  }
  </code></pre>
  
  <p><strong>Fragment B:</strong></p>
  
  <pre><code>public static void addMyView(){
      final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
      params.setMargins(0, 200, 0, 0);
  
      CustomView mView = new CustomView(mContext, "english", "a1", "10:12", "14:32");
      mLayout.addView(mView, params);
  
  // CustomView is the custom view I want to add
  
  }
  </code></pre>
  
  <p><strong>Question:</strong>
  I know that a fragment can't communicate with another fragment directly, how do I tell the activity to add a view permanently to FragmentB when the method <code>addMyView()</code> is called?</p>