I am using a typeface within the DrawText method on a canvas.
I declare the typeface with "Dim tf As Typeface" and I use it in the DrawText call and it works, but I am getting a warning that Variable 'tf' was not initialized.
There is no "Initialize" method for a typeface. How can I get rid of the error message?
Because when I do not declare it, I get "Undeclared variable 'tf' is used before it was assigned any value." and that is an error, so the code does not compile.
By declaring it, I just get a warning and the code compiles and runs.
Because when I do not declare it, I get "Undeclared variable 'tf' is used before it was assigned any value." and that is an error, so the code does not compile.
By declaring it, I just get a warning and the code compiles and runs.
Sorry, too quick of a response. Your code does work, thank you.
I am not sure where I got the original code from, but this is simpler anyways.
For completeness, here is how I was using it:
B4X:
Dim tf as TyeFace
canvas1.DrawText("This is a nice sentence.", 200dip, 200dip, tf.CreateNew(Typeface.DEFAULT, Typeface.STYLE_NORMAL), 30, Colors.Blue, "LEFT")