Parent Does Not Contain A Constructor That Takes 0 Arguments
My code is namespace classlibrary { public class numerictext : EditText { //My code } When I try to inherit a edit text control in a class library, I'm gettin
Solution 1:
For any Android-based View subclass, you need to supply the three constructors that call their base object constructors, ie.:
public class MyView : EditText
{
public MyView(Context context) : base(context) { }
public MyView(Context context, IAttributeSet attrs) : base(context, attrs) { }
public MyView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { }
// your override code....
}
Solution 2:
You need to call one of the base constructors in your derived class. Assuming you are using the Android EditText
widget:
public class numerictext : EditText
{
public numerictext(Context context) : base(context)
//^^^^^^^^^^^^^^^
//Note how we are now calling the base constructure
{
//empty or you can add your own code
}
public numerictext(Context context, IAttributeSet attrs) : base(context, attrs)
{
}
//etc
}
Solution 3:
Have you considered changing EditText to:
public class EditTtext
{
data stuff..
EditText() {}
other functions
}
Though I don't see why yours wouldn't work as is
Post a Comment for "Parent Does Not Contain A Constructor That Takes 0 Arguments"