Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App crashes on changing theme under styles

My Android App :

Target API:22

Min API:15

Device run on :API level 22

I don't understand this whole theme concept ,

In my manifest.xml ,I have set android:theme="@style/AppTheme"

and all activities use this theme

Now my understanding is that they all use the theme called AppTheme which I can now define by extending other themes inside my styles.xml

In my styles.xml

I have this

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>

My understanding is that AppCompat themes allow us to use newer(say material themes) on older devices also . I run this app on API Level 22 and API Level 15 , it works fine

Now when i change it to

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Material">
        <!-- Customize your theme here. -->
    </style>

</resources>

It gives a warning saying this theme can be used only on API 21 or above which is correct , now when I ignore the warning and run it in on API 22 it crashes. Why?

Also I tried to make AppTheme's parent as Holo , Light etc ,all of them crash the App , why , please explain?

All of these end up crashing the App

<style name="AppTheme" parent="android:Theme.Translucent">
   <style name="AppTheme" parent="android:Theme.Holo">

Why do these not work , Holo was introduced in 15 right?

I am using 22 ,

and can you please elaborate the difference between Theme....., BaseTheme....,Android..... themeName

And i am running android studio 1.3 and using the latest versions(Stable) of the SDK,SDK build and SDK-Platform tools. Thank you !

like image 762
Sainath S.R Avatar asked Oct 19 '22 09:10

Sainath S.R


1 Answers

Sorry , I found the issue , My activity was extending AppCompatActivity instead of the general activity ,I get it now

like image 187
Sainath S.R Avatar answered Oct 22 '22 01:10

Sainath S.R