我試圖創建一個自定義適配器,我有一個錯誤,說有可用 件構造的定義適配器
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;
}
}
沒有默認構造函數你會爲這個適配器接頭構造是什麼?