Android Question What is best way to handle custom colors across many layouts?

Steve Miller

Active Member
Licensed User
Longtime User
I have a tabbed screen with 11 layouts. I want to give the user the ability to pick their own colors for background, label text, and tabs. This will allow them to match to their company colors.

What I did was write a program for the computer that updates a database with the selected colors of each item. The tablet has the same database on it and gets a copy of this updated color table. Now, I want to apply the customers colors to each item across all the screens. What is the most efficient method of doing this?
 

LucaMs

Expert
Licensed User
Longtime User
If I have not been too distracted, it should be like this:
B4X:
Sub SetCustomColors

    If cColors.IsInitialized=False Then
        cColors.Initialize
    End If

    Dim r As Reflector
    r.Target = TabHost1
    r.Target = r.RunMethod("getTabWidget")
    For t = 0 To TabHost1.TabCount - 1
        Dim tabParentPanel As Panel
        tabParentPanel = r.RunMethod2("getChildAt", t, "java.lang.int")
        For x = 0 To tabParentPanel.NumberOfViews - 1
            Log("Tab #" & t & " View #" & x)
            SetViewColors(tabParentPanel.GetView(x))
        Next
    Next

End Sub

In fact, I was distracted, I put the code in another thread
 
Upvote 0

Steve Miller

Active Member
Licensed User
Longtime User
It's not doing anything for the views on the layouts on each tab. It's only hitting the tabs themselves.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User

I see nothing obviously wrong with your code but it's iterating over Labels twice?
Can you put a small sample project together and upload it and i'll try to debug it here.

Martin.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…