Using custom fonts on Android

Posted by karse23 on Stack Overflow See other posts from Stack Overflow or by karse23
Published on 2011-03-04T15:22:07Z Indexed on 2011/03/04 15:25 UTC
Read the original article Hit count: 187

Filed under:
|
|

Hi there,

I'm trying to load a custom font as follows:

private Paint customFont18;
customFont18 = new Paint();
customFont18.setTextSize(18);
Typeface fontFace = Typeface.createFromAsset(getAssets(), "FONT.TTF"); 
customFont18.setTypeface(fontFace);

The getAssets fails, thows this:

-The method getAssets() is undefined for the type MyClass
-assetManager cannot be resolved to a variable

What is my problem? I've seen several examples like this but none works in my case. Thanks in advance.

© Stack Overflow or respective owner

Related posts about java

Related posts about android