【发布时间】:2016-02-17 14:08:01
【问题描述】:
我正在尝试创建一个自定义适配器,我有一个错误说没有可用的默认构造函数
public class GuessAdapter extends ArrayAdapter <Game> {
Context context;
int resource;
Peg[] guess;
LayoutInflater inflater;
public void PegArrayAdapter(Peg[] array, Context ctxt){
guess= array;
context = ctxt;
inflater = (LayoutInflater) ctxt.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return guess.length;
}
@Override
public Game getItem(int arg0){
return guess[arg0];
}
public long getItemId(int arg0){
return arg0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2){
View view = arg1;
if (arg1==null){
arg1 = inflater.inflate(android.R.layout.simple_list_item_1, arg2, false);
}
ImageView imageView =(ImageView)arg1.findViewById(R.id.imageView);
ImageView imageView2=(ImageView)arg1.findViewById(R.id.imageView2);
ImageView imageView3=(ImageView)arg1.findViewById(R.id.imageView3);
ImageView imageView4=(ImageView)arg1.findViewById(R.id.imageView4);
return view;
}
}
这个适配器的合适构造函数是什么?
【问题讨论】:
标签: java android constructor adapter android-adapter