When I implement a custom dialog by using AlertDialog.Builder or DialogFragment which has a fairly complex layout (like this one) the dialog takes time to show up. But when the dialog just contains a couple of editText or so... there is no issue in showing up of the dialog. Why is it so?
Is it that the AlertDialog framework is used to build dialogs that are used just to alert the users? (as the name implies.)
Are there some other frameworks that can be used to implement complex custom dialogs?
I have tried the following things to fix the issue:
- Attempted to implement threading so that my dialog is ready in a background thread and show it when I want. But this is not allowed in general as any other thread except UI thread aren't supposed to touch UI related events.
- Made the dialog a global variable, initialized it in onCreate and then show the dialog onButtonClick.
- Switched to CONSTRAINT LAYOUT
- Used an activity as a dialog by setting the dialog theme to the activity in the manifest file.
I am extending to this question. Any help would be highly appreciated, thanks in advance.