Android custom font loading error -


i try use roboto black font in textview, tx.settypeface(tf); throwing error. says, "syntax error on token(s), misplaced construct(s)", , @ (tf) "syntax error on token "tf", variabledeclaratorid expected after token".

here snippit of code i'm using change font:

textview tx = (textview) findviewbyid(r.id.moomoo); typeface tf = typeface.createfromasset(getassets(), "roboto-black.ttf"); tx.settypeface(tf); 

to knowledge have change java file, while having font ttf file in assets folder, in child of assets folder called "fonts". need reference text view , can constructor of java class xml file's font i'm trying change, correct? logic flawed, doing wrong? android version 19.

change

typeface tf = typeface.createfromasset(getassets(), "roboto-black.ttf"); 

to

typeface tf = typeface.createfromasset(getassets(), "fonts/roboto-black.ttf"); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -