问题描述
- 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程序运行了会报错
解决方案
能贴下对应的exception?
解决方案二:
android show dialog
解决方案三:
new一个dialog对象啊。然后在show()
时间: 2024-11-05 07:00:35