XML : You need to use a Theme.AppCompat theme error, even with theme set to AppCompat

I am busy trying to implement The support library so that i can make use of AppCompatActivty

As far as I know I have everything in the correct place. But I am still getting the error.

styles.xml

  <resources>              <style name="AppBaseTheme" parent="Theme.AppCompat.Light">                  </style>        <!-- Application theme. -->      <style name="AppTheme" parent="AppBaseTheme">          <item name="colorPrimary">@color/colorPrimary</item>          <item name="colorPrimaryDark">@color/colorPrimaryDark</item>          <item name="colorAccent">@color/colorAccent</item>      </style>         </resources>    

v21/styles.xml

  <?xml version="1.0" encoding="utf-8"?>  <resources>  <style name="AppBaseTheme" parent="Theme.AppCompat.Light"></style>    <style name="AppTheme" parent="AppBaseTheme">      <!-- All customizations that are NOT specific to a particular API-level can go here. -->      <item name="colorPrimary">@color/colorPrimary</item>      <item name="colorPrimaryDark">@color/colorPrimaryDark</item>      <item name="colorAccent">@color/colorAccent</item>  </style>       </resources>    

manifest.xml

    <application          android:allowBackup="true"          android:icon="@drawable/ic_launcher_on"          android:label="@string/app_name"          android:supportsRtl="true"          android:theme="@style/AppTheme">    

activity.java

  public class RegisterActivity extends AppCompatActivity    

Now when I run my application and try open RegisterActivty I get the following error.

   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tuta_me/activities.RegisterActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.    

I must have missed something somewhere. What am I doing wrong?

No comments:

Post a Comment