title: Android - replace fragment
body: <p>I have a min activity it has two layout.</p>
  
  <pre><code>-----------Root Layout------------
  -                                -
  -           Layout 1             -
  ----------------------------------
  -                                -
  -           Layout2              -
  ----------------------------------
  </code></pre>
  
  <p>I replace mainActivity to fragment using <code>getSupportFragmentManager</code>, it works. Replace code is below : </p>
  
  <pre><code>fragmentTransaction.replace(rootLayoutId, fragment);
  </code></pre>
  
  <p>But I try to replace not all page only a spesific layout like below:</p>
  
  <pre><code> childFragMan = fragment.getChildFragmentManager();
   childFragTrans = childFragMan.beginTransaction();
   childFragTrans.add(layout1ID, subFragment);
   childFragTrans.addToBackStack(to);
   childFragTrans.commit();
  </code></pre>
  
  <p>My exception message is here : </p>
  
  <pre><code>java.lang.IllegalStateException: Activity has been destroyed
  06-08 18:46:15.022 5290-5290/? W/System.err:     at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1560)
  06-08 18:46:15.022 5290-5290/? W/System.err:     at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:696)
  06-08 18:46:15.022 5290-5290/? W/System.err:     at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:662)
  06-08 18:46:15.022 5290-5290/? W/System.err:     at io.smartface.plugin.SMFJSObject.callAsFunction(Native Method)
  06-08 18:46:15.022 5290-5290/? W/System.err:     at io.smartface.plugin.SMFJSObject.callAsFunction(SMFJSObject.java:271)
  06-08 18:46:15.022 5290-5290/? W/System.err:     at io.smartface.android.SFProxyInvocationHandler.handleMethodInJS(SFProxyInvocationHandler.java:40)
  06-08 18:46:15.022 5290-5290/? W/System.err:     at io.smartface.android.SFProxyInvocationHandler.invoke(SFProxyInvocationHandler.java:22)
  06-08 18:46:15.022 5290-5290/? W/System.err:     at java.lang.reflect.Proxy.invoke(Proxy.java:393)
  </code></pre>