We can show the fragment as a dialogue, using two methods, but one way.
Explanation:
Way:
Extend the DialogFragment class and override either of two methods:
onCreateView () OR
onCreateDialog ().
Diff between these two:
Overriding onCreateView () will allow you to display the "Snippet As" dialog, and you can customize the title text.
On the other hand, by overriding onCreateDialog (), you can show the fragment dialog again, and here you can configure the entire dialog fragment. So you can inflate any performance to show it as a dialogue.
If you need any source code explaining the text above, let me know.
Note:
Using DialogFragment has a drawback. It does not handle screen orientation. And the application crashes.
So you need to use setRetainInstance () inside the onCreate () of the DialogFragment class.
source share