Android Question [Solved] App with B4XTable giving java.lang.RuntimeException: Class instance was not initialized (b4xfloattextfield)

swChef

Active Member
Licensed User
Longtime User
This is solved.
I had to add a Sleep after the loadlayout (highlighted below), which allowed B4XTable's DesignerCreateView to run. Without that it never sets up the B4XTable's view before it gets used by the app.

Context.

App Activity in question has a number of controls including a CLV, which gets filled when clv_VisibleRangeChanged is called;
that causes a layout to be loaded named b4xtableonly containing just a B4XTable named B4XTable1.
The next 'usage' of B4XTable1 after the LoadLayout (such as just a .Clear) causes the (title) error as it accesses some labels that haven't been set up yet (uninitialized).

clv_VisibleRangeChanged:
Sub clv_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    For i = Max(0, FirstIndex - 5) To Min(clv.Size - 1, LastIndex + 5)
            Dim p As B4XView = clv.GetPanel(i)
            If p.NumberOfViews = 0 Then
                p.LoadLayout("b4xtableonly")
                Sleep(40)
                B4XTable1.Clear
                Dim mMap As Map = clv.GetValue(i)
 
Last edited:
Reactions: LGS
Cookies are required to use this site. You must accept them to continue using the site. Learn more…