How does the dialog fragment know where to display itself?


#1

In chapter 7, we add a fragment to an activity and specify the container in which to display the fragment.

In chapter 12, we call show on the dialog fragment, but how does it know where to display itself? We never pass it a container. Do fragments just display themselves on top of eachother when you call show? I’m a bit confused with how you can display a fragment when another fragment is already in the container.

Appreciate any help clearing this up!


#2

Dialog fragments don’t show themselves in a layout container like ordinary fragments. Instead, they create and show a Dialog on top of their activity.