我从Android编程开始。我不能编译我的程序,我得到以下错误:ArrayAdapter():找不到合适的构造函数
Error: no suitable constructor found for ArrayAdapter()
这里是我的personnal适配器:
public class StationListAdapter extends ArrayAdapter<Station> {
private ArrayList<Station> stations;
private Context context;
private int resource;
LayoutInflater layoutInflater;
//Constructor - args : (context, resourceId, ArrayList<MyClass>)
public StationListAdapter(Context context, int resource, ArrayList<Station> stations) {
this.context = context;
this.resource = resource;
this.stations = stations;
layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
这里是frament该实例的适配器的一部分:
public void onArrayListReady(ArrayList<Station> stations) {
TextView textView = (TextView) this.view.findViewById(R.id.fragment_list_textview);
ListView listView = (ListView) this.view.findViewById(R.id.fragment_list_stations_list);
adapter = new StationListAdapter(getActivity(), R.layout.fragment_list_row, stations);
listView.setAdapter(adapter);
}
你不会在你的适配器中调用'super' – Achrome 2014-10-28 23:29:45
非常感谢你的帮助。 – valvince 2014-10-28 23:51:41