title: Error in adding toolbar
body: <p>I want to add a toolbar to my app instead of Action bar. But when i add toolbar to my app, my app crashes and i don't know how.</p>
  
  <p>This is my code.</p>
  
  <p><strong>ToolbarActivity.java</strong></p>
  
  <pre><code>public class ToolbarActivity extends AppCompatActivity{
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_toolbar);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarsdfs);
          if (toolbar != null) {
              setSupportActionBar(toolbar);
              getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          }
      }
  }
  </code></pre>
  
  <p><strong>activity_toolbar.xml</strong></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" &gt;
  
  &lt;android.support.v7.widget.Toolbar
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/toolbarsdfs"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:minHeight="?attr/actionBarSize"
      android:background="?attr/colorPrimary" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>style.xml</strong></p>
  
  <pre><code>&lt;style name="AppTheme" parent="AppTheme.Base"/&gt;
  
      &lt;style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"&gt;
          &lt;item name="colorPrimary"&gt;@color/color1&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/color2&lt;/item&gt;
          &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
          &lt;item name="windowActionBar"&gt;false&lt;/item&gt;
      &lt;/style&gt;
  </code></pre>
  
  <p><strong>LogCat</strong></p>
  
  <pre><code>08-12 14:31:05.905: E/AndroidRuntime(18413): FATAL EXCEPTION: main
  08-12 14:31:05.905: E/AndroidRuntime(18413): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tech.Toolbar/com.tech.toolbar.ToolbarActivity}: java.lang.NullPointerException
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1734)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.app.ActivityThread.startActivityNow(ActivityThread.java:1569)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:158)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:370)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:701)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.widget.TabHost.setCurrentTab(TabHost.java:373)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:167)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:487)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.view.View.performClick(View.java:2535)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.view.View$PerformClick.run(View.java:9129)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.os.Handler.handleCallback(Handler.java:618)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.os.Handler.dispatchMessage(Handler.java:123)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.os.Looper.loop(SourceFile:351)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.app.ActivityThread.main(ActivityThread.java:3820)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at java.lang.reflect.Method.invokeNative(Native Method)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at java.lang.reflect.Method.invoke(Method.java:538)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:969)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:727)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at dalvik.system.NativeStart.main(Native Method)
  08-12 14:31:05.905: E/AndroidRuntime(18413): Caused by: java.lang.NullPointerException
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.support.v7.internal.app.WindowDecorActionBar.getDecorToolbar(WindowDecorActionBar.java:248)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.support.v7.internal.app.WindowDecorActionBar.init(WindowDecorActionBar.java:201)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.support.v7.internal.app.WindowDecorActionBar.&lt;init&gt;(WindowDecorActionBar.java:176)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.support.v7.app.AppCompatDelegateImplV7.createSupportActionBar(AppCompatDelegateImplV7.java:174)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:90)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.support.v7.app.AppCompatActivity.getSupportActionBar(AppCompatActivity.java:77)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at com.tech.toolbar.ToolBarActivity.onCreate(ToolBarctivity.java:12)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1698)
  08-12 14:31:05.905: E/AndroidRuntime(18413):    ... 18 more
  08-12 14:31:05.920: E/dalvikvm(18413): [DVM] mmap return base = 45e92000
  </code></pre>
  
  <p><strong>Manifest</strong></p>
  
  <pre><code>&lt;uses-sdk
          android:minSdkVersion="10" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/&gt;
  &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/CustomActionBarTheme"
           &gt;
  &lt;activity
              android:name=".MainActivity"
              android:label="Tab"
              android:noHistory="true" &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;activity 
             android:name=".ToolBarActivity"
             android:theme="@style/AppTheme" /&gt;            
  
              &lt;/application&gt;
  </code></pre>
  
  <p>I have tried everything possible to achieve my goal but to no avail. My app min SDK is 10. I am using eclipse Luna for development.</p>