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...
 

DonManfred

Expert
Licensed User
Longtime User
for what do you need
Font As String in the parameters? You did not use it
Or are you using Font1 in the sub-call als Parameter for font?
 
Upvote 0
Top