I am Starting with Android programming. I can't compile my program as I get the following error :
Error: no suitable constructor found for ArrayAdapter()
Here is my personnal adapter:
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);
}
Here is the part of the frament that instance the adapter:
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);
}
You'll need to call a super constructor from your constructor in order to properly initialize your adapter.