I having this custom array adapter:
public class CustomAdapter extends ArrayAdapter<DataObj>
{
int layoutResourceId;
List<DataObj> data;
Activity activity;
Typeface iconFont;
public CustomAdapter(Activity activity, int layoutResourceId, List<DataObj> data)
{
super(activity, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.activity = activity;
this.data = data;
iconFont = Typeface.createFromAsset(activity.getAssets(), "icons.ttf" );
}
public static class ViewHolder
{
public TextView icon;
public TextView name;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View row = convertView;
ViewHolder holder;
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.layout_icon_EditText);
holder.name = (TextView) row.findViewById(R.id.layout_name_EditText);
row.setTag(holder);
}
else
{
holder = (ViewHolder) row.getTag();
}
final DataObj obj = data.get(position);
if (eventType != null)
{
holder.icon.setText(obj.getIconCode());
holder.icon.setTypeface(iconFont);
holder.name.setText(obj.getName());
}
return row;
}
}
Instead of icon I see code (I am using IcoMoon as my icon font). Other icons in my app that are created statically are seen, But here I see this:
what is wrong with my code?
Here is how it works when it is static (it is not an image it is the font of IcoMoon):
Note: I tried to use other fonts (not icon fonts) and it worked, it seems that only icon fonts not working.