Your theme isn t set to use Theme AppCompat or Theme materialcomponents flutter stripe

Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Your theme isn t set to use Theme AppCompat or Theme materialcomponents flutter stripe

Hello guys, so I'm working on the "Generating 9-Patch Images" video lecture for the Ribbit app. Once I followed the instruction to delete some existing codes in the styles.xml folder, my app can't be opened.

Here is my code for the styles.xml file:

<resources>

<style name="AppTheme" parent="@style/_AppTheme"/> <style name="_AppTheme" parent="android:Theme.Holo.Light"> <item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_light</item> <item name="android:buttonStyle">@style/ButtonAppTheme</item> <item name="android:imageButtonStyle">@style/ImageButtonAppTheme</item> </style> <style name="ButtonAppTheme" parent="android:Widget.Holo.Light.Button"> <item name="android:background">@drawable/apptheme_btn_default_holo_light</item> </style> <style name="ImageButtonAppTheme" parent="android:Widget.Holo.Light.ImageButton"> <item name="android:background">@drawable/apptheme_btn_default_holo_light</item> </style>

</resources>

When I ran the app, this error appears in the logcat:

Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:151) at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:138) at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123) at com.charlesli.ribbit.MainActivity.onCreate(MainActivity.java:171) at android.app.Activity.performCreate(Activity.java:5104) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)             at android.app.ActivityThread.access$600(ActivityThread.java:141)             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)             at android.os.Handler.dispatchMessage(Handler.java:99)             at android.os.Looper.loop(Looper.java:137)             at android.app.ActivityThread.main(ActivityThread.java:5041)             at java.lang.reflect.Method.invokeNative(Native Method)             at java.lang.reflect.Method.invoke(Method.java:511)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)             at dalvik.system.NativeStart.main(Native Method)

Any help is much appreciated! Thank you in advance!

8 Answers

Your theme isn t set to use Theme AppCompat or Theme materialcomponents flutter stripe

Charles,

I ran into the same problem, here is how I got around the issue:

<resources> <style name="ButtonAppTheme" parent="android:Widget.Holo.Light.Button"> <item name="android:background">@drawable/apptheme_btn_default_holo_light</item> </style> <style name="ImageButtonAppTheme" parent="android:Widget.Holo.Light.ImageButton"> <item name="android:background">@drawable/apptheme_btn_default_holo_light</item> </style> <style name="AppTheme" parent="@style/_AppTheme"/> <!-- <style name="_AppTheme" parent="android:Theme.Holo.Light"> --> <style name="_AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_light</item> <item name="android:buttonStyle">@style/ButtonAppTheme</item> <item name="android:imageButtonStyle">@style/ImageButtonAppTheme</item> </style> </resources>

Your theme isn t set to use Theme AppCompat or Theme materialcomponents flutter stripe

I encountered this issue today , but resolved now! If you want to use ActionBarActivity, you must use AppCompat theme, so the solution is change MainActivity extends FragmentActivity, Change SignInActivity, SignUpActivity extends Activity instead of extends ActionBarActivity.

FYI: https://developer.android.com/guide/topics/ui/actionbar.html On API level 11 or higher: The action bar is included in all activities that use the Theme.Holo theme (or one of its descendants), which is the default theme when either the targetSdkVersion or minSdkVersion attribute is set to "11" or higher. If you don't want the action bar for an activity, set the activity theme to Theme.Holo.NoActionBar.

Your theme isn t set to use Theme AppCompat or Theme materialcomponents flutter stripe

Unsubscribed User March 27, 2015 10:43pm

Great discussion. It was extremely helpful! Thank you guys, now I´m wondering why we needed to add:


<EditText android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/EditTextCustomHolo"/>


To make the edit Text show the right color, but it wasnt needed for the Button.

Your theme isn t set to use Theme AppCompat or Theme materialcomponents flutter stripe

Thanks to you 2, I got the same issue, and your discussion was very helpful!

Unsubscribed User March 27, 2015 10:43pm

<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPassword" android:id="@+id/passwordField" android:hint="@string/password_hint" android:textColorHint="@color/light_gray" android:textSize="17sp" style="@style/EditTextCustomHolo" />

Unsubscribed User March 27, 2015 10:44pm

For the edit Text: android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPassword" android:id="@+id/passwordField" android:hint="@string/password_hint" android:textColorHint="@color/light_gray" android:textSize="17sp" style="@style/EditTextCustomHolo"

Your theme isn t set to use Theme AppCompat or Theme materialcomponents flutter stripe

Solving "underline" color of the editText in "Generating 9-Patch Images" video lecture. If the "underline" of the editText does not turn purple when running in the genymotion emulator for Android 5.0 (API level 21), you have to copy all values from the styles.xml file under "values" folder, and paste them in the styles.xml file under "values-v21" folder. Android 5.0 (API level 21) uses that "values-v21/style.xml" file as alternative layout files. Use the same code given in the video lecture, don't change anything. Do not change <style name="_AppTheme" parent="android:Theme.Holo.Light"> to <style name="_AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">.