title: android fragment inside dialog
body: <p>I have an issue where I need to show a <code>fragment</code> in a <code>android.app.Dialog</code> </p>
  
  <p>here is the xml code</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;FrameLayout
          android:id="@+id/marchecharts"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
      &lt;/FrameLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>what I want is to replace <code>marchecharts</code> by my fragment, can anyone help</p>
  
  <p>thanks</p>
  
  <pre><code>Dialog dialog = new Dialog(getActivity());
  dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.marche_charts_parent);
  
  
  //this is the part I think I need
  Fragment fragment = new MarcheChartsFragment();
  FragmentTransaction ft = ((FragmentActivity) dialog.getOwnerActivity()).getFragmentManager().beginTransaction();
  ft.replace(R.id.marchecharts, fragment);  
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
  ft.addToBackStack(null);
  ft.commit();
  
  dialog.setCanceledOnTouchOutside(true);
  dialog.getWindow().setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
  dialog.show();
  </code></pre>