I am going through this tutorial on Android here http://www.vogella.com/articles/AndroidDebugging/article.html
And in the exercise it gives some code with a fault. It says the problem is in here
public MyArrayAdapter(Context context, List<String> values) {
super(context, android.R.layout.simple_list_item_1);
this.context = context;
this.values = values;
}
This is a constructor for a defined class MyArrayAdapter that extends ArrayAdapter. The tutorial says that the call constructor for the super class ArrayAdpater is wrong. Well I tried debugging it, I don't see what the problem is. Any insight, maybe I don't understand the ArrayAdapter concept well.
Your constructor is wrong
public MyArrayAdapter(Context context, List<String> values) {
Look at the ArrayAdapter Docs and there is no constructor which takes these arguments
Probably the simplest is to use this constructor
ArrayAdapter(Context context, int resource, List objects)
and add your layout file for the other parameter. Also, change your super call accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With