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
Post a Comment