Android Question [SOLVED] Creating themes for many Android versions ?

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello,
I am referring to this post : https://www.b4x.com/android/forum/threads/custom-theme-error.65955/#post-417610

Erel proposes a way to create themes at compilation for "both Android 4 and Android 5+". My question is : how could I be sure to handle all android's versions ?
Shouldn't I create a default "value" ?

I am asking this because I have got error reports with some Samsung devices running KitKat (API 19) and which used the theme I did create for Lollipop+
Thanks

java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.ws.ktk/fr.ws.ktk.main}: android.view.InflateException: Binary XML file line #38: Error inflating class com.android.internal.widget.ActionBarView
at fr.ws.ktk.main.onCreate(main.java:59)

Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class com.android.internal.widget.ActionBarView

Caused by: java.lang.reflect.InvocationTargetException
Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class android.widget.TextView

Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2

B4X:
SetApplicationAttribute(android:theme, "@style/AppTheme")
CreateResource(values-v21, theme.xml,
<resources>
  <style name="AppTheme" parent="android:Theme.Material">
  <item name="android:colorPrimary">#3e3e41</item>
  <item name="android:colorPrimaryDark">#2d2d30</item>
  <item name="android:colorAccent">#ebece8</item>
  </style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
  <style name="AppTheme" parent="@android:style/Theme.Holo.Light">
  </style>
</resources>
)
 
Last edited:

lemonisdead

Well-Known Member
Licensed User
Longtime User
Thanks Erel. I just (sorry for the delay I took), so I just understood that B4A was able to manage all the Android's specifications (in fact I now see it more like an IDE than a language based software)... I feel stupid :)
 
Upvote 0
Top