title: FragmentActivity with NavigationDrawer in FullScreen throws RuntimeException
body: <p>I'm trying to implement a <a href="http://developer.android.com/design/patterns/navigation-drawer.html" rel="nofollow"><code>Navigation Drawer</code></a> using <a href="http://developer.android.com/reference/android/support/v4/app/FragmentActivity.html" rel="nofollow"><code>FragmentActivity</code></a>.<br>
  And I need to have the application in <a href="https://developer.android.com/design/patterns/fullscreen.html" rel="nofollow"><code>FullScreen</code></a> mode.</p>
  
  <p>The application throws a <a href="http://developer.android.com/reference/java/lang/RuntimeException.html" rel="nofollow"><code>RuntimeException</code></a> whenever I add this line of code in manifest</p>
  
  <blockquote>
    <p>android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"</p>
  </blockquote>
  
  <p>If I remove this line, then it works well !</p>
  
  <p>Here's my code:</p>
  
  <p><strong>manifest.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.sample.app"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="14"
          android:targetSdkVersion="17" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:largeHeap="true" 
          android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" &gt;
  
          &lt;activity
              android:name="com.sample.app.MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                   &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;                
          &lt;/activity&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>activity_main.xml</strong></p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity" &gt;
  
      &lt;FrameLayout
          android:id="@+id/main"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
      &lt;/FrameLayout&gt;
  
      &lt;ListView
          android:id="@+id/drawer"
          android:layout_width="240dp"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:background="#FFFFFF"
          android:choiceMode="singleChoice"/&gt;  
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package com.sample.app;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.FragmentTransaction;
  import android.support.v4.widget.DrawerLayout;
  import android.view.View;
  import android.view.WindowManager;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  public class MainActivity extends FragmentActivity {
      final String[] data ={"one","two","three"};
      final String[] fragments ={
              "com.sample.app.FragmentOne"};
      @Override
      protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);
  
           ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActionBar().getThemedContext(), R.layout.drawer_list_item, data);
           final DrawerLayout drawer = (DrawerLayout)findViewById(R.id.drawer_layout);
           final ListView navList = (ListView) findViewById(R.id.drawer);
           navList.setAdapter(adapter);
           navList.setOnItemClickListener(new OnItemClickListener(){
                   @Override
                   public void onItemClick(AdapterView&lt;?&gt; parent, View view, final int pos,long id){
                           drawer.setDrawerListener( new DrawerLayout.SimpleDrawerListener(){
                                   @Override
                                   public void onDrawerClosed(View drawerView){
                                           super.onDrawerClosed(drawerView);
                                           FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
                                           tx.replace(R.id.main, Fragment.instantiate(MainActivity.this, fragments[pos]));
                                           tx.commit();
                                   }
                           });
                           drawer.closeDrawer(navList);
                   }
           });
           FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
           tx.replace(R.id.main,Fragment.instantiate(MainActivity.this, fragments[0]));
           tx.commit();
      }
  
  }
  </code></pre>
  
  <p><strong>fragment_one.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:id="@+id/textView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:text="one" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>FragmentOne.java</strong></p>
  
  <pre><code>package com.sample.app;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class FragmentOne extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
          ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_one, null);
          return root;
      }
  
  }
  </code></pre>
  
  <p>And Here's the error log</p>
  
  <pre><code>03-27 10:09:47.384: E/AndroidRuntime(993): FATAL EXCEPTION: main
  03-27 10:09:47.384: E/AndroidRuntime(993): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sample.app/com.sample.app.MainActivity}: java.lang.NullPointerException
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.os.Handler.dispatchMessage(Handler.java:99)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.os.Looper.loop(Looper.java:137)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.app.ActivityThread.main(ActivityThread.java:5041)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at java.lang.reflect.Method.invokeNative(Native Method)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at java.lang.reflect.Method.invoke(Method.java:511)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at dalvik.system.NativeStart.main(Native Method)
  03-27 10:09:47.384: E/AndroidRuntime(993): Caused by: java.lang.NullPointerException
  03-27 10:09:47.384: E/AndroidRuntime(993):  at com.sample.app.MainActivity.onCreate(MainActivity.java:32)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.app.Activity.performCreate(Activity.java:5104)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  03-27 10:09:47.384: E/AndroidRuntime(993):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  03-27 10:09:47.384: E/AndroidRuntime(993):  ... 11 more
  </code></pre>
  
  <p><strong>Why I cannot have full screen for this fragment activity which contains navigation drawer ?</strong></p>
  
  <hr>
  
  <p>BTW, i tried to add  </p>
  
  <pre><code>android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
  </code></pre>
  
  <p>to the activity itself not the application, but it throws the same error.</p>
  
  <p><br>And I tried to add these lines on code </p>
  
  <pre><code>this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  getActionBar().setDisplayShowTitleEnabled(false);
  getActionBar().setDisplayShowHomeEnabled(false);
  ((FragmentBreadCrumbs)(findViewById(android.R.id.title))).setVisibility(View.GONE);
  </code></pre>
  
  <p>to <code>MainActivity.oncreate</code> before <code>setContentView(R.layout.activity_main)</code> but it throws the same error</p>