Android Question BBLabel or BBCodeView Background Color

Mahares

Expert
Licensed User
Longtime User
I searched for BBLabel and BBCodeView Background Color in the forum and in the pertinent b4xlib classes , but could not detect it. I am trying to mimic a project where I have used background color with CSBuilder, but with BCTextEngine I tried the following variants but none works: background-color, backgroundcolor, bgcolor
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Thank you. I applied it to a B4XPages project. It worked well. I have to note that: the use of tags is a must to wrap the highlighted words. Also, since I was using a small sentence, it worked whether the lazy loading is checked or unchecked in the designer. Using a background in BBCodeView was more cumbersome than using a background in CSBuilder, but, it works nonetheless.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I modeled my B4XPages project by the use of the snippet in Erel's above link. The B4J part of the project works well, but the B4A part crashes:
Private Sub AddBackgroundPanels
B4X:
For Each x As B4XView In BBCodeView1.sv.ScrollViewInnerPanel.GetAllViewsRecursive
        If x.Tag = "background" Then   'Crash at this line which is line 78
            x.RemoveViewFromParent
        End If
    Next
Error occurred on line: 78 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1055)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1061)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:418)
at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:246)
at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:260)
at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:166)
at b4a.example.main._activity_create(main.java:417)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.example.main.afterFirstLayout(main.java:105)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
 
Upvote 0
Top