私はチュートリアルからこのコードを書きました。
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
// TODO Auto-generated method stub
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.single_row, viewGroup,false);
TextView title = (TextView) row.findViewById(R.id.txtTitle);
TextView description = (TextView) row.findViewById(R.id.txtDescription);
ImageView image = (ImageView) row.findViewById(R.id.imgPic);
SingleRow temp = list.get(i);
title.setText(temp.title);
description.setText(temp.description);
image.setImageResource(temp.image);
return row;
}
このコード行では:
TextView title = (TextView) row.findViewById(R.id.txtTitle);
TextView が同じ種類の変数にコピーされていると思います。次に、このコード行で:
title.setText(temp.title);
その変数に何かを入力します。次に、ビューであり、「タイトル」変数に関連しない行変数が返されます。
使い方?これらの変数はここでは何の関係もないと思います。