Android Question Custom Font Problem (Typeface.LoadFromAssets)

Juan Luis Lopez

Member
Licensed User
Longtime User
Hi everyone!
Im trying to use a custom font into an edittext.
Font file is called "Lunxbox Slab.otf" and I sync it in the left panel.
Then i use this code:
B4X:
Sub Activity_Create(FirstTime As Boolean)

   Activity.LoadLayout("aaa")
   Dim fuente As Typeface
   fuente.LoadFromAssets("Lunchbox Slab.otf")
   EditText1.Typeface= fuente
End Sub
ERROR: Object should be first initialized (Typeface)
Any Idea? I saw examples in thus forum and they were like mine i think...
Thanks!

[DONE]
B4X:
fuente.LoadFromAssets("Lunchbox Slab.otf")
Wrong
B4X:
fuente= Typeface.LoadFromAssets("Lunchbox Slab.otf")
Right

OMG im a noob...
 
Last edited:

Theera

Well-Known Member
Licensed User
Longtime User
Hi there,
Try to see this.
 
Upvote 0
Top