您有自定义列表视图与以下代码段.
问题是当我运行代码时应用程序崩溃这是我的代码
class MyAdupter extends ArrayAdapter{ Context context; String[] title ; String[] description; int[] images; public MyAdupter(Context context, String[] title, String[] description, int[] images) { super(context, R.layout.my_simple_row,title); this.context = context; this.title = title; this.description = description; } @Override public View getView(int position, View convertView, ViewGroup parent) { Layoutlnflater inflater = (Layoutlnflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.my_simple_row, parent, false); ImageView imageView = (ImageView) row.findViewById (R.id.imageViewl); TextView textTitle = (TextView) row.findViewById (R.id.textViewl); TextView textDescription = (TextView) row.findViewById(R.id.textView2); imageView.setImageResource(images[position]); textTitle.setText(title[position]); textDescription.setText(description[position]); return row; } }
Quick learne.. 7
那么你忘了在构造函数中为images数组赋值
this.images=image;
试试吧 !!!
那么你忘了在构造函数中为images数组赋值
this.images=image;
试试吧 !!!