小编Bhr*_*esh的帖子

如何在此代码中删除NullPointerException

您有自定义列表视图与以下代码段.
问题是当我运行代码时应用程序崩溃这是我的代码

class MyAdupter extends ArrayAdapter<String>{
     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; …
Run Code Online (Sandbox Code Playgroud)

android arraylist nullpointerexception android-arrayadapter

-4
推荐指数
1
解决办法
113
查看次数