出门时警告

时间:2017-12-08 09:16:00

标签: java android compiler-errors

当我离开该计划时  此警报显示

这个错误是什么?

  

错误:错误:此类应提供默认构造函数(不带参数的公共构造函数)(com.example.hp.myapplication23.CustomList)[Instantiatable]

这些是我的代码:

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CustomList extends ArrayAdapter<String> {

    private final  Activity context;
    private final String[] name ;
    private final String[] gen ;
    private final Integer[] img ;


    public CustomList(Activity context, String[] name , String[] gen , Integer[] img) {
        super(context, R.layout.custom_list,name );


        this.context = context;
        this.name = name ;
        this.gen = gen ;
        this.img = img ;
    }

    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater infalter = context.getLayoutInflater();
        View v = infalter.inflate(R.layout.custom_list	, null , true);

        TextView txtName = (TextView) v.findViewById(R.id.name);
        TextView txtGen = (TextView) v.findViewById(R.id.gen);
        ImageView image = (ImageView) v.findViewById(R.id.imageView1);

        txtName.setText(name[position]);
        txtGen.setText(gen[position]);
        image.setImageResource(img[position]);

        return v ;








    }


}

请指导我

0 个答案:

没有答案