B4J Question ABMaterial - Change background Image

codie01

Active Member
Licensed User
Longtime User
Hi All,

I have two themes in ABMShared as Follows:

B4X:
    '------------------------------------------------------------------------------------
    'dark theme
    '------------------------------------------------------------------------------------
    'button themes ---------------------------------
    MyDarkTheme.AddButtonTheme("buttonTheme1") '/used as chips in browsers
    MyDarkTheme.Button("buttonTheme1").BackColor = ABM.COLOR_GREY
    MyDarkTheme.Button("buttonTheme1").BackColorIntensity = ABM.INTENSITY_DARKEN3
    MyDarkTheme.Button("buttonTheme1").ForeColor = ABM.COLOR_WHITE
    MyDarkTheme.Button("buttonTheme1").ZDepth = ABM.ZDEPTH_REMOVE
    
    'cell themes -----------------------------------
    MyDarkTheme.AddCellTheme("cellThemeright3") 'used on images
    MyDarkTheme.Cell("cellThemeright3").Align = ABM.CELL_ALIGN_RIGHT

    '------------------------------------------------------------------------------------
    'light theme
    '------------------------------------------------------------------------------------

    '/planner theme
    MyTheme.AddPlannerTheme("sectionPlanner")
    MyTheme.Planner("sectionPlanner").MenuColor = ABM.COLOR_BLUEGREY
    MyTheme.Planner("sectionPlanner").MenuColorIntensity = ABM.INTENSITY_DARKEN3
    MyTheme.Planner("sectionPlanner").MenuTextColor = ABM.COLOR_WHITE
    MyTheme.Planner("sectionPlanner").DayBorderColor = ABM.COLOR_BLUEGREY
    MyTheme.Planner("sectionPlanner").DayColor = ABM.COLOR_BLUEGREY
    MyTheme.Planner("sectionPlanner").DayTextColor = ABM.COLOR_BLACK
    MyTheme.Planner("sectionPlanner").BackColor = ABM.COLOR_BLUEGREY
    MyTheme.Planner("sectionPlanner").HourColor = ABM.COLOR_BLUEGREY
    MyTheme.Planner("sectionPlanner").BorderColor = ABM.COLOR_BLACK
    MyTheme.Planner("sectionPlanner").HourColorIntensity = ABM.INTENSITY_LIGHTEN2
    MyTheme.Planner("sectionPlanner").HourTextColor = ABM.COLOR_BLACK
    MyTheme.Planner("sectionPlanner").HourAltColor = ABM.COLOR_WHITE
    MyTheme.Planner("sectionPlanner").HourAltTextColor = ABM.COLOR_BLACK
    MyTheme.Planner("sectionPlanner").HourMinutesUsedColors(0,ABM.COLOR_BLUEGREY)
    MyTheme.Planner("sectionPlanner").HourMinutesUsedColorsIntensity(0,ABM.INTENSITY_DARKEN4)
    MyTheme.Planner("sectionPlanner").HourMinutesUsedColors(1,ABM.COLOR_BLUEGREY)
    MyTheme.Planner("sectionPlanner").HourMinutesUsedColorsIntensity(1,ABM.INTENSITY_DARKEN2)
    MyTheme.Planner("sectionPlanner").HourMinutesUsedColors(2,ABM.COLOR_BLUEGREY)
    MyTheme.Planner("sectionPlanner").HourMinutesUsedColorsIntensity(2,ABM.INTENSITY_NORMAL)
    MyTheme.Planner("sectionPlanner").HourMinutesUsedColors(3,ABM.COLOR_BLUEGREY)
    MyTheme.Planner("sectionPlanner").HourMinutesUsedColorsIntensity(3,ABM.INTENSITY_LIGHTEN2)
    MyTheme.Planner("sectionPlanner").HourMinutesNotAvailableColorIntensity = ABM.INTENSITY_DARKEN3

I then select the theme based on cookie setting, however I get "ERROR: No theme found with the name 'MyDarkTheme'. Using the first theme found." when I try to call it with the following code:

B4X:
public Sub ConnectPage()
    If myDarken = "N" Then
        page.SetActiveTheme("MyTheme")
    Else
        page.SetActiveTheme("MyDarkTheme")
    End If

I have added the themes as follows:

B4X:
public Sub BuildTheme()
    ' start with the base theme defined in ABMShared
    MyTheme.AddABMTheme(ABMShared.MyTheme)
    MyDarkTheme.AddABMTheme(ABMShared.MyDarkTheme)
    ' add extra page specific theme stuff

What Am i doing wrong!
Thanks
 
Last edited:
Top