Answer the question
In order to leave comments, you need to log in
Which dialog call option do you use in Android?
One question has been tormenting for a long time - what is the best way to call a dialog in Android and why?
The SDK offers two options: showDialog(Dialog dialog) and showDialog(int dialogId [, Bundle bundle]), where the second one is marked as deprecated, and it is recommended to use a similar fragment method, but the essence remains the same.
In the first case, I can create complex dialogs, fill them from the database, but when the screen is rotated, they disappear forever.
In the second case, the dialog does well when rotated, but is created once during the lifetime of the Activity, so it is difficult to display actual data if the dialog needs to be raised more than once and with different initial data.
What do you think about this? Maybe I missed something?
Answer the question
In order to leave comments, you need to log in
I use
android.app.AlertDialog
with hisandroid.app.AlertDialog.Builder
Fully controlled dialog - you can use three buttons (you can hang different names), hang your view, listeners on button presses, etc. It is created every time anew - dynamically. therefore, there are difficulties with displaying actual data if the dialog needs to be raised more than once and with different initial data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question