来自 Activity 类型的 showDialog(int) 方法在 android 中已弃用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11220820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:22:29  来源:igfitidea点击:

The method showDialog(int) from the type Activity is deprecated in android?

androiddialogandroid-dialog

提问by Sekar

The method showDialog(int)from the type Activityis deprecated.

该方法showDialog(int)从类型Activity弃用

enter image description here

在此处输入图片说明

What's the reason? and how to solve it?

什么原因?以及如何解决?

回答by Dheeresh Singh

What's the reason?

什么原因?

http://developer.android.com/reference/android/app/Activity.html#showDialog(int)

http://developer.android.com/reference/android/app/Activity.html#showDialog(int)

Android DialogFragment vs Dialog

Android DialogFragment 与 Dialog

How to solve it?

如何解决?

Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package.

将新的 DialogFragment 类与 FragmentManager 一起使用;这也可以通过 Android 兼容包在旧平台上使用。

http://android-developers.blogspot.in/2012/05/using-dialogfragments.html

http://android-developers.blogspot.in/2012/05/using-dialogfragments.html