Android Question Reading in Font File

DawningTruth

Active Member
Licensed User
I have the following code to set the button font for a B4xDialog

B4X:
dialog.ButtonsFont = XUI.CreateFont(File.OpenInput(File.DirAssets,"myfont.ttf"),16)

When I execute this code I get the following error:

Access to the path 'C:\B4x Projects\My Android Project\MyProject\Objects\bin\extra\assets\myfont.ttf' is denied.

The font is in the assets folder. But access denied.

Any suggestions?
 

DawningTruth

Active Member
Licensed User
Figured it out. For reference for others the code for loading the font should be:

B4X:
dialog.ButtonsFont = XUI.CreateFont(Typeface.LoadFromAssets("myfont.ttf"),16)

The access denied was caused by windows locking the directory. Nothing to do with B4A.
 
Upvote 0
Top