在调试模式下编译时一切正常。但是在Release配置中进行编译时,会发生以下错误:
错误:(28)错误:此类应提供默认构造函数(不带参数的公共构造函数)(myclassname.HelpDialog)[Instantiatable]
这是代码
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();
}
});
}
}
答案 0 :(得分:6)
添加这个兄弟:
public HelpDialog( ){
super(null);
}