コード例 #1
0
ファイル: ChildAdapter.java プロジェクト: skdenmark/Zebra
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;

    if (v == null) {
      v = inflater.inflate(R.layout.children_list_row, null);
    }

    TextView nameTextView = (TextView) v.findViewById(R.id.name);
    TextView countTextView = (TextView) v.findViewById(R.id.count);
    ImageView childImage = (ImageView) v.findViewById(R.id.child_image);

    Child c = items.get(position);

    nameTextView.setText(c.getName());
    countTextView.setText(c.getSequenceCount() + " sekvenser");

    if (c.getPicture() == null) {
      childImage.setImageDrawable(activity.getResources().getDrawable(R.drawable.placeholder));
    } else {
      childImage.setImageDrawable(c.getPicture());
    }

    return v;
  }