Font Awesome in Android ListView does not work… here is a solution to the problem.
Font Awesome in Android ListView does not work
So I created this custom array adapter:
View row = convertView;
ViewHolder holder;
iconFont = Typeface.createFromAsset(activity.getAssets(), "fontawesome-webfont.ttf" );
if (row == null)
{
LayoutInflater layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = layoutInflater.inflate(R.layout.event_type_list_row, null);
holder = new ViewHolder();
holder.icon = (TextView) row.findViewById(R.id.EventTypeListRow_icon_EditText);
holder.name = (TextView) row.findViewById(R.id.EventTypeListRow_name_EditText);
row.setTag(holder);
}
else
{
holder = (ViewHolder) row.getTag();
}
final EventTypeDataObj eventType = data.get(position);
if (eventType != null)
{
holder.icon.setText(eventType.getIconCode()); f02c;
holder.icon.setText("" );
holder.icon.setTypeface(iconFont);
holder.name.setText("" );
holder.name.setTypeface(iconFont);
}
return row;
I
don’t see my drawbacks, I see the code in the ListView as follows:
Note: Other fonts (for letters instead of icons). At work.
Is there any reason why it doesn’t work?
Solution

Obviously an XML entity. I have no reason to believe that android should be treated that way, rather than treating it as a normal string. Given your screenshots, this is clearly the case.
If you want to specify characters by giving them unicode values, the correct usage in Java is \u
, like this:
holder.name.setText("\uf001");
Edit
It is also possible if your input is "f001;"
And cannot be replaced by “\uf001"
to decode XML entities in strings using Html.fromHtml
:
holder.name.setText(Html.fromHtml("&#f001;" ));