私の MyAdapter クラスでは、(Context context, String[] values)
以下のコードに示すようにパラメーターを渡しています。String[] values
getView() メソッドで変数を使用したい。この変数を getView() メソッドに渡す方法はありますか?
class MyAdapter extends ArrayAdapter<String> {
public MyAdapter(Context context, String[] values) {
super(context, R.layout.row_layout_2, values);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater theInflater = LayoutInflater.from(getContext());
View theView = theInflater.inflate(R.layout.row_layout_2, parent, false);
String tvShow = getItem(position);
TextView theTextView = (TextView) theView.findViewById(R.id.textView1);
theTextView.setText(tvShow);
ImageView theImageView = (ImageView) theView.findViewById(R.id.imageView1);
theImageView.setImageResource(R.drawable.dot);
return theView;
}
}