-3

i have tried to use android:Theme.Material.Ligh in my values-v21/styles.xml and my activity extends AppCompatActivity, which android didnt allow and got error saying 'IllegalStateException:You need to use a Theme.AppCompat theme (or descendant) with this activity'
So i went through different threads on stackoverflow where people have discussed about this same error and i got little bit of clarity but couldn't exactly understood when we can use android:Theme.Material.Ligh theme in our activity and when we can't use it. For my app minSdkVersion is 15 and targetSdkVersion is 24

hemkar
  • 27
  • 1
  • 6

1 Answers1

0

make sure AppTheme in your values/style.xml also uses AppCompat 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>
</style>
Jayanth
  • 5,954
  • 3
  • 21
  • 38