So I have 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 the I cons, I see the code in the list view like here:
Note: other fonts (which works on letters not icons). are working.
Is there amy reason it is not working?

is apparently an XML entity. I have no reason to believe android should treat the as such, and not as a plain string of characters. Which apparently it does, given your screenshot.
If you want to specify characters by giving their unicode value, the correct usage in java is \u
, like so :
holder.name.setText("\uf001");
It is also possible, if your input is "&#f001;"
and cannot be replaced by "\uf001"
to use Html.fromHtml
to decode the XML entities in the String:
holder.name.setText(Html.fromHtml("&#f001;"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With