Android Question Get manifest values

Discussion in 'Android Questions' started by ALBRECHT, Aug 8, 2019.

  1. ALBRECHT

    ALBRECHT Member Licensed User

    Hello,

    After setting some value into the manifest.xml

    as for example :

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

    Michel
     
  2. DonManfred

    DonManfred Expert Licensed User

    You can try
    Code:
    Dim ac as AppCompat
    Dim actionbarcolor as Int

    actionbarcolor = ac.GetThemeAttribute(
    "actionbar")
     
    BillMeyer and Peter Simpson like this.
  3. ALBRECHT

    ALBRECHT Member Licensed User

    Return -1

    i have on manifest :

    Code:
    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 :

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

    Johan Schoeman Expert Licensed User

  5. ALBRECHT

    ALBRECHT Member Licensed User

    ok, many thanks
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice