DialogFragment Class Deprecated in Android P DialogFragment Class Deprecated in Android P android android

DialogFragment Class Deprecated in Android P


Google is encouraging all developers to shift from the ordinary DialogFragment to the support version of the same class, you can still use the deprecated version of course but if Google recommends the support version, why wouldn't you?

Simply change your import statement from android.app.DialogFragment to android.support.v4.app.DialogFragment.

Also, consider changing all the imports if you are using the deprecated version of normal fragments.

UPDATE

If you are using the brand new AndroidX library instead of the old support library change it to androidx.fragment.app.DialogFragment but pay attention about how you are using the DialogFragment in your code because you have to migrate also to the new androidx.fragment.app.FragmentActivity.