@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.row, null); } Message m = items.get(position); // if (m != null) { m.createColorFromString(m.from); TextView tt = (TextView) v.findViewById(R.id.username); TextView bt = (TextView) v.findViewById(R.id.message); if (isMonospaced) { tt.setTypeface(Typeface.MONOSPACE); bt.setTypeface(Typeface.MONOSPACE); } tt.setText(m.getFrom()); tt.setTextColor(m.color); bt.setText(m.getMessage()); // } return v; }
@Override public int getCount() { return items.size(); }