CAC*_*lan 5 android android-fragments android-alertdialog
我正在为 Honeycomb 重写一个现有的应用程序,但遇到了一个问题。在现有的应用程序中,我们创建了一个带有默认标题和消息值的 AlertDialog,然后在需要时替换它们。为了替换它们,我们使用 setTitle() 和 setMessage():
AlertDialog dialog = getDialog();
if (some condition) {
dialog.setTitle(R.string.error1);
dialog.setMessage(getResources().getString(R.string.error1_msg));
}
else {
dialog.setTitle(R.string.error2);
dialog.setMessage(getResources().getString(R.string.error2_msg));
}
Run Code Online (Sandbox Code Playgroud)
但是,现在我们使用的是DialogFragment,没有setTitle()或setMessage()的方法,所以我们不能在它创建后更改它。这种情况有解决方法,还是我们运气不好?
| 归档时间: |
|
| 查看次数: |
6330 次 |
| 最近记录: |