0
В моем классе MyAdapter я передаю параметры (Context context, String[] values)
, как показано ниже в моем коде. Я хочу использовать переменную String[] values
в методе getView(). Есть ли способ передать эту переменную в метод getView()?Передача большего количества параметров методу getView() в ArrayAdapter
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;
}
}