title: How to add a fragment to a dynamically created FrameLayout
body: <p>I need to create the frame layout and surrounding layout dynamically. With the <code>FragmentManager</code> you have to use the layout's identifier to add the fragment.</p>
  
  <p>When creating a layout dynamically, it does not have an identifier.</p>
  
  <pre><code>FrameLayout frameLayout = new FrameLayout(this);   
  MyFragment fragment = new MyFragment();
  
  getSupportFragmentManager()
                  .beginTransaction()
                  .add(R.id.??????, fragment)
                  .commit();
  </code></pre>
  
  <p>Here I struggle. Can I generate an identifier on the fly and assign it with <code>frameLayout.setId()</code>? Is there an alternative?</p>