Reputation: 2781
I want to set font awesome to one text view in my application. I used it like below and it works fine:
Typeface font = Typeface.createFromAsset( getAssets(), "fontawesome/fonts/fontawesome-webfont.ttf" );
TextView awesomeButton = (TextView)findViewById(R.id.awesome_button);
awesomeButton.setTypeface(font);
awesomeButton.setText(MainActivity.this.getString(R.string.heart));
But when i want to use it like below cod, It doesn't work:
Typeface font = Typeface.createFromAsset( getAssets(), "fontawesome/fonts/fontawesome-webfont.ttf" );
TextView awesomeButton = (TextView)findViewById(R.id.awesome_button);
awesomeButton.setTypeface(font);
awesomeButton.setText("");
Upvotes: 2
Views: 135
Reputation: 69689
try this
Typeface font = Typeface.createFromAsset( getAssets(), "fontawesome/fonts/fontawesome-webfont.ttf" );
TextView awesomeButton = (TextView)findViewById(R.id.awesome_button);
awesomeButton.setTypeface(font);
awesomeButton.setText(Html.fromHtml(""));
Upvotes: 1
Reputation: 3193
you can try this code I think this one help you.
Typeface font = Typeface.createFromAsset( getAssets(), "fontawesome/fonts/fontawesome-webfont.ttf" );
TextView awesomeButton = (TextView)findViewById(R.id.awesome_button);
awesomeButton.setTypeface(font);
String tmpHtml = "<html>♥</html>";
String htmlTextStr = Html.fromHtml(tmpHtml).toString();
awesomeButton.setText(htmlTextStr);
Upvotes: 0
Reputation: 79
Can you try with below code
awesomeButton.setText(Html.fromHtml(""));
Upvotes: 0