title: FragmentManager findFragmentById return null
body: <p>The code of activity_fragment.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/fragmentContainer"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
  /&gt;
  </code></pre>
  
  <p>The code of CrimeListActivity.java</p>
  
  <pre><code>package com.sinory.criminalintent;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.util.Log;
  
  public class CrimeListActivity extends SingleFragmentActivity {
  
      @Override
      protected Fragment createFragment() {
          return new CrimeListFragment();
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          Log.d("CrimeListActivity", "create");
      }
  
  }
  </code></pre>
  
  <p>The code of SingleFragmentActivity.java</p>
  
  <pre><code>package com.sinory.criminalintent;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.FragmentManager;
  
  public abstract class SingleFragmentActivity extends FragmentActivity {
  
      protected abstract Fragment createFragment();
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_fragment);
  
          FragmentManager fm = getSupportFragmentManager();
          Fragment fragment = fm.findFragmentById(R.id.fragmentContainer);
  
          if (null == fragment) {
              fragment = new CrimeListFragment();
              fm.beginTransaction().add(R.id.fragmentContainer, fragment).commit();
          }
      }
  }
  </code></pre>
  
  <p>Just started to learn Android. Why Fragment fragment = fm.findFragmentById(R.id.fragmentContainer) is null? Please help me.</p>