2 griezmann Griezmann 于 2016.04.12 11:20 提问

android dialog在show之前怎么初始化?

/*Dialog集合*/
private void initDialog() {
list_dialog = new ArrayList<>();
dialog_checkbox = new CheckBoxDialog(LoginActivity.this, 1, R.layout.checkbox, mClient);
dialog_radio = new RadioDialog(LoginActivity.this, 1, R.layout.select, mClient);
dialog_grade = new GradeDialog(LoginActivity.this, 1, R.layout.grade, mClient);
dialog_answer = new AnswerDialog(LoginActivity.this, 1, R.layout.answer, mClient);
dialog_question = new QuestionDialog(LoginActivity.this, 1, R.layout.quiz, mClient);
dialog_praise = new PraiseDialog(LoginActivity.this, 1, R.layout.praise, mClient);
list_dialog.add(dialog_checkbox);
list_dialog.add(dialog_radio);
list_dialog.add(dialog_grade);
list_dialog.add(dialog_answer);
list_dialog.add(dialog_question);
list_dialog.add(dialog_praise);
}
/*showDialog*/
private void showMyDialog(final int id) {
dismissDialog();
mHandler.post(new Runnable() {
@Override
public void run() {
dialog = list_dialog.get(id);
dialog.show();
}
});
}
代码是这样的 在show里面加initdialog程序运行了会报错

3个回答

luoxiaozhuo
luoxiaozhuo   2016.04.12 14:22

能贴下对应的exception?

CSDNXIAON
CSDNXIAON   2016.04.13 17:53

android show dialog
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

crazy1235
crazy1235   Ds   Rxr 2016.04.14 09:54

new一个dialog对象啊。然后在show()

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!