title: No view found for id - DialogFragment + Fragment
body: <p>I have a DialogFragment with a simple layout. I want to add a fragment (and in the future replace this fragment with another) to a FrameLayout that is inside the DialogFragment's layout. However, the method of adding the new fragment fails with the error:</p>
  
  <p>"No view found for id 0x7f0b004f com.kennel39.diabeteslive_adtdev:id/frameAlertsContainer) for       fragment Fragment_AlertsManage {41e7cb68}"</p>
  
  <p>I have checked my xml, attempted different methods and have read a number of similar issues on stackoverflow but I cannot find a solution.</p>
  
  <pre><code>public class DialogManageAlerts extends DialogFragment{
  static int patient_id;
  
  public static DialogManageAlerts newInstance(int given_patient_id){
      DialogManageAlerts frag = new DialogManageAlerts();
      patient_id = given_patient_id;
  
      Bundle bund = new Bundle();
      bund.putInt("Patient_id", patient_id);
      frag.setArguments(bund);
      return frag;
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      View mainView = inflater.inflate(R.layout.dialog_alerts_master, container, false);              
      getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
  
      FragmentManager myFragmentManager = getFragmentManager();
      FragmentTransaction myTransact = myFragmentManager.beginTransaction();
      Fragment_AlertsManage manageAlertsFragment = new Fragment_AlertsManage();
      myTransact.add(R.id.frameAlertsContainer, manageAlertsFragment);
      myTransact.commit();
  
      return mainView;
  }
  </code></pre>
  
  <p>layout.dialog_alerts_master:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:background="@color/white_regular" &gt;
  
      &lt;LinearLayout 
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:padding="10dp"
          android:background="@drawable/lower_border_background_white"&gt;
  
      &lt;TextView
          android:id="@+id/tvManageAlertsTitle"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/manage_alerts_title"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:gravity="center_horizontal" /&gt;
      &lt;/LinearLayout&gt;
      &lt;FrameLayout
          android:id="@+id/frameAlertsContainer"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" &gt;
      &lt;/FrameLayout&gt;    
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And the Fragment_AlertsManage class:</p>
  
  <pre><code>public class Fragment_AlertsManage extends Fragment implements OnClickListener {
      int patient_id;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          View myView = inflater.inflate(R.layout.fragment_alerts_manage, container, false); 
  
          //Get buttons       
          Button btnAdd = (Button)myView.findViewById(R.id.btnAddAlert);
          btnAdd.setOnClickListener(this);
          Button btnBack = (Button)myView.findViewById(R.id.btnBack);
          btnBack.setOnClickListener(this);
  
          //FILL CONTENT
          populateContent(myView);
  
          return myView;      
      }
  
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          switch (v.getId()) {
              case R.id.btnAddAlert: {
                  //Switch fragment
                  FragmentManager myFragmentManager = getFragmentManager();
                  FragmentTransaction myTransact = myFragmentManager.beginTransaction();
                  Fragment_AlertsAdd addAlertFragment = new Fragment_AlertsAdd();
                  myTransact.addToBackStack("Previous");
                  myTransact.replace(this.getView().getId(), addAlertFragment);
                  myTransact.commit();
  
                  break;
              }
              case R.id.btnBack: {
                  FragmentManager myFragmentManager = getFragmentManager();
                  FragmentTransaction myTransact = myFragmentManager.beginTransaction();
                  myTransact.remove(Fragment_AlertsManage.this);
                  //Launch Home
                  Intent homeIntent = new Intent(this.getActivity(), HomeActivity.class);
                  homeIntent.putExtra("patient_id", patient_id);
                  startActivity(homeIntent);
                  getActivity().finish();
  
                  break;
              }
          }
      }
  
      public void populateContent(View myView){
          try {
              ArrayList&lt;Alert&gt; alerts = new RetrieveAlerts(patient_id).execute().get();
  
              ListView list = (ListView) myView.findViewById(R.id.reminder_listview);
              AlertsListAdapter alertsAdapter = new AlertsListAdapter(this.getActivity(), alerts);
              list.setAdapter(alertsAdapter);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (ExecutionException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>Why am I getting this error, and what can I do to solve it?</p>