Android Question Get manifest values

ALBRECHT

Active Member
Licensed User
Hello,

After setting some value into the manifest.xml

as for example :

B4X:
<color name="actionbar">#ff039be5</color>
how to get that value inside code ?

Michel
 

ALBRECHT

Active Member
Licensed User
Return -1

i have on manifest :

B4X:
CreateResource(values, colors.xml,
<resources>
   <color name="textColorPrimary">#ff000000</color>
   <color name="actionbar">#ff039be5</color>
   <color name="statusbar">#ff006db3</color>
   <color name="navigationBar">#ff006db3</color>
   <color name="ColorBackButton">#ff808080</color>
</resources>
)

CreateResource(values-v20, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Material.Light">
        <item name="android:colorPrimary">@color/actionbar</item>
        <item name="android:colorPrimaryDark">@color/statusbar</item>
        <item name="android:textColorPrimary">@color/textColorPrimary</item>
        <item name="android:navigationBarColor">@color/navigationBar</item>
        <item name="android:colorAccent">@color/navigationBar</item>
        <item name="android:alertDialogTheme">@style/AlertDialogCustom</item>
    </style>

    <style name="AlertDialogCustom" parent="@android:style/Theme.Material.Light.Dialog.Alert">
      <item name="android:colorPrimary">@color/actionbar</item>
      <item name="android:colorAccent">@color/navigationBar</item>
    </style>

    <style name="button" parent="@android:style/Widget.Material.Button">
        <item name="android:background">@color/ColorBackButton</item>
        <item name="android:textColor">@color/textColorPrimary</item>
    </style>   
</resources>
)
and when i call :

B4X:
    Dim ac As AppCompat
    Dim actionbarcolor As Int
    actionbarcolor = ac.GetThemeAttribute("statusbar")
    Log(actionbarcolor)
that return always -1
even with others var name ?
 

ALBRECHT

Active Member
Licensed User
ok, many thanks
 
Top