Android Question Object converted to String. This is probably a programming mistake.

Cableguy

Expert
Licensed User
Longtime User
Hi Guys
I have a Sub that I call using:

B4X:
Header2.TextSize = SetTextSize("Advanced Player",Font2,Header2)

My sub is:

B4X:
Private Sub SetTextSize(text As String,Font As String, control As View) As Double
    Dim cv As Canvas
    cv.Initialize(Activity)
    Dim FSize As Double
    FSize = 1
    Do Until cv.MeasureStringHeight(text,Font1,FSize) = control.Height
        FSize = FSize + 1
    Loop
    FSize = Floor(FSize * 0.7)
    Log(FSize)
    Return FSize
End Sub

Althoug this gives no error and it works as expected, I get a warning...

B4X:
Object converted to String. This is probably a programming mistake.

Font1 is a typeface object and Header is a LabelView.

I just wish to understand why...
 

Cableguy

Expert
Licensed User
Longtime User
@DonManfred, Thanks, that was it... while adjusting my sub, I totaly forgot about the sub declaration.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…