title: findViewById(R.id.drawer_layout) returns null
body: <p>I have a problem with the the following line:</p>
  
  <pre><code>mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
  </code></pre>
  
  <p>returning null.</p>
  
  <p>For debugging purpose, I have tried the XML file found on the official Android DrawerLayout tutorial:</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  &lt;!-- The main content view --&gt;
  &lt;FrameLayout
      android:id="@+id/fragment_container"
      android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  &lt;!-- The navigation drawer --&gt;
  &lt;ListView android:id="@+id/left_drawer"
      android:layout_width="240dp"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:choiceMode="singleChoice"
      android:divider="@android:color/transparent"
      android:dividerHeight="0dp"
      android:background="#111"/&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>And this is the top of my FragmentActivity file:</p>
  
  <pre><code>import org.json.JSONException;
  import org.json.JSONObject;
  
  import android.annotation.SuppressLint;
  import android.app.ProgressDialog;
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.content.IntentFilter;
  import android.net.ConnectivityManager;
  import android.net.NetworkInfo;
  import android.os.Bundle;
  import android.support.v4.app.ActionBarDrawerToggle;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.content.LocalBroadcastManager;
  import android.support.v4.widget.DrawerLayout;
  import android.util.Log;
  import android.view.View;
  import android.widget.Toast;
  
  public class PuzzleAllActivity extends FragmentActivity {
  
  private ProgressDialog dialog;
  
  private ActionBarDrawerToggle mDrawerToggle;
  private DrawerLayout mDrawerLayout;
  
  
  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_puzzle_all);
  
      mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
      if(mDrawerLayout == null){
          Log.d("DEBUG", "Drawer layout is null");
      }
      mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
              R.drawable.menu_icon, R.string.drawer_open,
              R.string.drawer_close) {
  
          public void onDrawerClosed(View view) {
              //getActionBar().setTitle(mTitle);
              if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.GINGERBREAD) {
                  invalidateOptionsMenu();
              }
          }
  
          public void onDrawerOpened(View drawerView) {
              //getActionBar().setTitle(mDrawerTitle);
              if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.GINGERBREAD) {
                  invalidateOptionsMenu();
              }
          }
      };
  
      mDrawerLayout.setDrawerListener(mDrawerToggle);
  </code></pre>
  
  <p>For some reason, mDrawerLayout is null, which gives me a java.lang.NullPointerException for the last line:</p>
  
  <pre><code>mDrawerLayout.setDrawerListener(mDrawerToggle); 
  </code></pre>
  
  <p>I'm relative new to Android programming and have no clue what could cause this problem.</p>
  
  <p>I have made sure that Support Libraries in the project build path are checked.</p>
  
  <p>This is the error I get:</p>
  
  <pre><code>02-15 22:12:03.712: E/AndroidRuntime(17259): FATAL EXCEPTION: main
  02-15 22:12:03.712: E/AndroidRuntime(17259): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.puzzleall.puzzleall/com.puzzleall.puzzleall.PuzzleAllActivity}: java.lang.NullPointerException
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.app.ActivityThread.access$700(ActivityThread.java:150)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.os.Handler.dispatchMessage(Handler.java:99)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.os.Looper.loop(Looper.java:176)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.app.ActivityThread.main(ActivityThread.java:5279)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at java.lang.reflect.Method.invokeNative(Native Method)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at java.lang.reflect.Method.invoke(Method.java:511)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at dalvik.system.NativeStart.main(Native Method)
  02-15 22:12:03.712: E/AndroidRuntime(17259): Caused by: java.lang.NullPointerException
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at com.puzzleall.puzzleall.PuzzleAllActivity.onCreate(PuzzleAllActivity.java:71)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.app.Activity.performCreate(Activity.java:5267)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
  02-15 22:12:03.712: E/AndroidRuntime(17259):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
  </code></pre>
  
  <p>I appreciate any help I can get :)</p>