title: This Activity already has an action bar supplied by the window decor?
body: <p>I am developing an android app in matrial design.I am trying to use toolbar as the action bar of my app.but when run app i crasging &amp; get the errror.</p>
  
  <pre><code>Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
  </code></pre>
  
  <p>I have already gone through these links but not working 
  <a href="https://stackoverflow.com/questions/26515058/this-activity-already-has-an-action-bar-supplied-by-the-window-decor">link</a>    <a href="https://stackoverflow.com/questions/30016847/this-activity-has-an-action-bar-supplied-by-the-window-decor">link2</a></p>
  
  <p><strong>style.xml</strong></p>
  
  <p></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/primary&lt;/item&gt;
      &lt;item name="colorPrimaryDark"&gt;@color/primaryDarker&lt;/item&gt;
      &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
      &lt;item name="android:windowActionBar"&gt;false&lt;/item&gt;
      &lt;item name="drawerArrowStyle"&gt;@style/DrawerArrowStyle&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"&gt;
      &lt;item name="spinBars"&gt;true&lt;/item&gt;
      &lt;item name="color"&gt;@android:color/white&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;color name="primary"&gt;#457C50&lt;/color&gt;
  &lt;color name="primaryDarker"&gt;#580C0C&lt;/color&gt;
  </code></pre>
  
  <p>
  MianActivity.java</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  
      Toolbar toolbar;
      DrawerLayout mDrawerLayout;
      FrameLayout mainView;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
          toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar);
          mainView=(FrameLayout)findViewById(R.id.frame_container);
          ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(
                  this,
                  mDrawerLayout,
                  toolbar,
                  R.string.app_name,
                  R.string.app_name
          )
  
          {
              public void onDrawerClosed(View view)
              {
                  super.onDrawerClosed(view);
                  invalidateOptionsMenu();
                  syncState();
              }
  
              public void onDrawerOpened(View drawerView)
              {
                  super.onDrawerOpened(drawerView);
                  invalidateOptionsMenu();
                  syncState();
              }
              @Override
              public void onDrawerSlide(View drawerView, float slideOffset) {
                  // TODO Auto-generated method stub
                  super.onDrawerSlide(drawerView, slideOffset);
                  mainView.setTranslationX(slideOffset * drawerView.getWidth());
                      mDrawerLayout.bringChildToFront(drawerView);
                      mDrawerLayout.requestLayout();
  
              }
          };
          mDrawerLayout.setDrawerListener(actionBarDrawerToggle);
  
          //Set the custom toolbar
          if (toolbar != null){
               setSupportActionBar(toolbar);
          }
  
  
  
          actionBarDrawerToggle.syncState();
      }
  }
  </code></pre>
  
  <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.example.myapp"
      android:versionCode="1"
      android:versionName="1.0"
       &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="14"
          android:targetSdkVersion="21" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.SET_WALLPAPER" /&gt;
  
      &lt;application
          android:name="com.example.myapp.app.AppController"
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme"
           &gt;
          &lt;activity
              android:name=".Login"
              android:label="@string/app_name"
              android:windowSoftInputMode="stateVisible|adjustResize" &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="com.example.myapp.MainActivity" &gt;
          &lt;/activity&gt; 
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>