Android Question is there a better way of collecting a label layout data for saving?

Marc De Loose

Member
Licensed User
Longtime User
is there a better way of collecting a label layout data for saving?

Right now I have this:

B4X:
Sub CreateIdashDisp
   
    Dim maxX As Float = 100%x
    Dim maxY As Float = 100%y
    Dim rpmTop As Float = rpmDotGap
   
    iDashDisp.Clear
   
    For i = 1 To MAXIRACINGDATAS
        Dim riDashDispConfig As iDashDispConfig
       
        Dim xV As B4XView    ' just so I can get the color member
        Dim theLabel As Label        ' to keep code a bit clean
       
        Dim rlblData  As labelInfo
        xV                          = lblData(i)
        theLabel                 = lblData(i)
       
        rlblData.lColor            =    xV.Color
        rlblData.lEllipsize        =    theLabel.Ellipsize
        rlblData.lEnabled        =    theLabel.Enabled
        rlblData.lGravity        =     theLabel.Gravity
        rlblData.lHeight        =    theLabel.Height
        rlblData.lLeft            =    theLabel.Left
        rlblData.lText            =    theLabel.Text
        rlblData.lTextColor        =    theLabel.TextColor
        rlblData.lTextSize        =    theLabel.TextSize
        rlblData.lTop            =    theLabel.Top
        rlblData.lVisible        =    theLabel.Visible
        rlblData.lWidth            =    theLabel.Width
       
        Dim rlblLabel As labelInfo
        xV                          = lblLabel(i)
        theLabel                 = lblLabel(i)
        rlblLabel.lColor        =    xV.Color
        rlblLabel.lEllipsize    =    theLabel.Ellipsize
        rlblLabel.lEnabled        =    theLabel.Enabled
        rlblLabel.lGravity        =     theLabel.Gravity
        rlblLabel.lHeight        =    theLabel.Height
        rlblLabel.lLeft            =    theLabel.Left
        rlblLabel.lText            =    theLabel.Text
        rlblLabel.lTextColor    =    theLabel.TextColor
        rlblLabel.lTextSize        =    theLabel.TextSize
        rlblLabel.lTop            =    theLabel.Top
        rlblLabel.lVisible        =    theLabel.Visible
        rlblLabel.lWidth        =    theLabel.Width
       
       
        riDashDispConfig.ID             = i
        riDashDispConfig.Datas            = Datas(i)
        riDashDispConfig.labeldataInfo  = rlblData
        riDashDispConfig.labellabelInfo    = rlblLabel
        riDashDispConfig.MaxX        = maxX
        riDashDispConfig.MaxY        = maxY
        riDashDispConfig.rpmTopPos    = rpmTop
        iDashDisp.Add(riDashDispConfig)
    Next
   
    WriteIdashDispListToFile
   
End Sub

Sub WriteIdashDispListToFile
    ' File.DirInternal
    Dim raf As RandomAccessFile
   
    raf.Initialize(File.DirInternal,"iDashDispCOnfig.dat",False)
    raf.WriteObject(iDashDisp,False,0)
    raf.Close
 
Top