O
O
orbit0702019-06-20 02:52:04
Android
orbit070, 2019-06-20 02:52:04

Why can't the AlertDialog be displayed immediately in the activity?

Hello.
Google shows an example of creating a popup dialog in a DialogFragment. That is, a DialogFragment is created there and the AlertDialog is displayed in it.
But if you do not create a DialogFragment and display AlertDialog in the activity itself, then everything will look exactly the same as if we manually created the DialogFragment as in the first case.
Question: what is the point of creating a DialogFragment and calling AlertDialog in it if you can call it directly in the activity?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2019-06-20
@orbit070

In restoring the state when changing the configuration and opening from the list of recent applications. The fragment dialog will restore everything by itself, just the Alert dialog will not, and you will have to separately do squats with a tambourine around it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question