-2

I am getting the following warning and exception:

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.

RuntimeException: Unable to start activity ComponentInfo{com.mdinfosystem.mymobileapp/com.mdinfosystem.mymobileapp.Bill_Payment}: 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.

MasterAM
  • 16,283
  • 6
  • 45
  • 66

2 Answers2

0

If you are using toolbar, specify Theme.AppCompat.NoActionBaras parent in your activity's styles.xml. And in your activity simply use this:

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

Note: Your activity should extend AppCompatActivity

Srijith
  • 1,695
  • 17
  • 29
0

It actually tells you what to do in the

logCat:

set windowActionBar to false in your theme

Go to your styles.xml and add:

<item name="windowActionBar">false</item> 
Ahmad Sanie
  • 3,678
  • 2
  • 21
  • 56
  • style.xml – Jyoti Bhola Jul 14 '15 at 11:15
  • ok so you are using name="android:windowActionBar">false !! NOTICE android:windowActionBar is not the same as: windowActionBar so include it as: false and it will work. – Ahmad Sanie Jul 14 '15 at 11:19