最佳答案
来自 http://developer.android.com/reference/android/app/Activity.html
public final void showDialog (int id) Added in API level 1
This method was deprecated in API level 13. Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package.
Simple version of showDialog(int, Bundle) that does not take any arguments. Simply calls showDialog(int, Bundle) with null arguments.
为什么
- 显示对话窗口的 fragment , float 在其 Activity 窗口的顶部。该 fragment 包含一个 Dialog 对象,它会根据 fragment 的状态适本地显示该对象。对话框的控制(决定何时显示、隐藏、关闭)应通过此处的 API 完成,而不是直接调用对话框。
- 这是一个很好的讨论 Android DialogFragment vs Dialog
- 另一个很好的讨论 DialogFragment advantages over AlertDialog
如何解决?
更多
关于android - 不推荐使用 showDialog。有什么选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10285047/