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.