Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
waar19 opened this issue Feb 5, 2017 · 5 comments
Open

Comments

@waar19
Copy link

waar19 commented Feb 5, 2017

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) 

@nooballday
Copy link

i have the same issue, did you solve it?

@AhmedHamedTN
Copy link

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

@shivam-codelee
Copy link

just add in this your style.xml file

<style name="AppThemeCustomized" parent="Theme.AppCompat.Light.DarkActionBar"> @color/colorPrimary @color/colorPrimaryDark @color/colorAccent false true </style>

and in manifest add

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

@am9072
Copy link

am9072 commented Apr 5, 2019

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

@wendreof
Copy link

It worked.. a little...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants