android-json-form-wizard icon indicating copy to clipboard operation
android-json-form-wizard copied to clipboard

This Activity already has an action bar supplied by the window decor

Open waar19 opened this issue 8 years ago • 5 comments

java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3150) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3260) at android.app.ActivityThread.access$1000(ActivityThread.java:218) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1734) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6934) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. at android.support.v7.app.AppCompatDelegateImplV9.setSupportActionBar(AppCompatDelegateImplV9.java:203) at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:130) at com.vijay.jsonwizard.activities.JsonFormActivity.onCreate(JsonFormActivity.java:38) at android.app.Activity.performCreate(Activity.java:6609) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3103) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3260)  at android.app.ActivityThread.access$1000(ActivityThread.java:218)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1734)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:145)  at android.app.ActivityThread.main(ActivityThread.java:6934)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 

waar19 avatar Feb 05 '17 20:02 waar19

i have the same issue, did you solve it?

nooballday avatar Apr 26 '17 10:04 nooballday

I think this solved the issue for me, add the following two lines in styles.xml

<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>

    </style>

</resources>

Hope this helps fix the issue.

This is the Source

AhmedHamedTN avatar May 22 '17 17:05 AhmedHamedTN

just add in this your style.xml file

and in manifest add

android:theme="@style/AppThemeCustomized" where you have defined your activity

shivam-codelee avatar Jan 04 '18 06:01 shivam-codelee

There are two simple and quick solutions

go to res-->values-->styles watch the simple video for the answer https://youtu.be/YJR8njVHRA4

You can remove your window action bar by setting NoActionBar <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> or by adding false true

am9072 avatar Apr 05 '19 12:04 am9072

It worked.. a little...

wendreof avatar May 11 '19 02:05 wendreof