Error:(28) Error: This class should provide a default constructor (a public constructor with no arguments) (myclassname.HelpDialog) [Instantiatable]

我的未来我决定 提交于 2019-12-25 00:25:42

问题


Everything went fine while compiling in debug mode. But while compiling in Release configuration, following error occurs :

Error:(28) Error: This class should provide a default constructor (a public constructor with no arguments) (myclassname.HelpDialog) [Instantiatable]

This is the code

public class HelpDialog extends Dialog {

    Activity mActivity;
    Button btn_go_back;   

    public HelpDialog(Activity mactivity) {
        super();
        this.mActivity = mactivity;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.dialog_help);   

        btn_go_back = (Button)findViewById(R.id.btn_help_go_back);

        btn_go_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }
}

回答1:


Add this bro:

public HelpDialog( ){ 
  super(null);
}


来源:https://stackoverflow.com/questions/28110939/error28-error-this-class-should-provide-a-default-constructor-a-public-cons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!