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.:
publicclassMyView : EditText
{
publicMyView(Context context) : base(context) { }
publicMyView(Context context, IAttributeSet attrs) : base(context, attrs) { }
publicMyView(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:
publicclassnumerictext : EditText
{
publicnumerictext(Context context) : base(context)
//^^^^^^^^^^^^^^^ //Note how we are now calling the base constructure
{
//empty or you can add your own code
}
publicnumerictext(Context context, IAttributeSet attrs) : base(context, attrs)
{
}
//etc
}
Post a Comment for "Parent Does Not Contain A Constructor That Takes 0 Arguments"