Android Question [RESOLVED] how can I create a BBLabel by code, without using the designer?

Lucas Siqueira

Active Member
Licensed User
how can I create a BBLabel by code, without using the designer?

I want to add it to a panel, and put a text in BBLabel on it, I've tried it in many ways, but it always says you need to initialize ...

if i do it via designer it works blz, but in my case i will need it via code, because i will build a customview class ...

Could someone post a code thread?
I visited several topics, including:, but unfortunately I couldn't make it work ...: (

I tried, but to no avail.
    Dim panel As B4XView = xui.CreatePanel("")
    panel.Color = xui.Color_Blue

    Dim bblabel As BBLabel
    bblabel.Text=$"[FontAwesome=0xF17B size=30/] This is a [b]BB[color=0xff006688]Label[/color][/b]"$

bblabel._parseanddraw (java line: 169)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(
at anywheresoftware.b4a.objects.B4XViewWrapper.asPaneWrapper(
at anywheresoftware.b4a.objects.B4XViewWrapper.getNumberOfViews(
at b4j.example.bblabel._parseanddraw(
at b4j.example.bblabel._settext(
at b4j.example.main._appstart(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at anywheresoftware.b4a.BA.raiseEvent2(
at anywheresoftware.b4a.BA.raiseEvent(
at b4j.example.main.start(
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(
at com.sun.javafx.application.PlatformImpl.lambda$null$172(
at Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(
at Method)
Last edited: