Skip to content Skip to sidebar Skip to footer

Android Custom Arrayadapter Constructor Issue

I am making a custom arrayAdapter for my listview, but a simple thing like my super constructor is messing me up! private ArrayAdapter timeHold; //make prop

Solution 1:

Just because the constructor you are defining takes a certain parameter list, it doesn't mean the super class has that constructor. After all, you can define any arbitary parameter list for your constructor.

The super constructor you are trying to call is closest to ones in the ArrayAdapter class, but the error message suggests you are trying to inherit from SimpleAdapter. Have you got this right? If it should be ArrayAdapter, the last argument needs to be the array (or List) of the objects which back the adapter, instead of just a single object of that type.

If it is SimpleAdapter, the only constructor is here, which looks quite a bit different.

Solution 2:

super is used to call the constructor of the superclass, the class you're extending. Look at the documentation: the constructor of SimpleAdapter has different arguments.

Post a Comment for "Android Custom Arrayadapter Constructor Issue"