The Android design documentation in http://developer.android.com/design/building-blocks/dialogs.html makes a clear differentiation between Dialogs, Alerts, Popups and Toasts. It also recommends the implementation of Dialogs by means of the DialogFragment
class and Toasts by means of the Toast
class. However it's not clear to me whether Popups should be implemented with PopupWindow
or with DialogFragment
.
I know that DialogFragments
usually come with Ok/Cancel buttons and that the location of PopupWindows
can be defined, but:
- Are these slight differences the only arguments to use one or the other?
- Is
DialogFragment
the successor ofPopupWindow
that will be deprecated at some point? - According to the answer in https://mcmap.net/q/637743/-should-i-use-a-popupwindow-or-dialogfragment-for-accepting-input, PopupWindow is "Limited to a few templates", but I can't find any reference to a limited amount of templates in the class documentation.
- So, finally, how would you implement Popups like these http://developer.android.com/design/media/dialogs_popups_example.png and why?
DialogFragment
even for windows such as list_dialog that doesn't have buttons. Besides, I guess that the fact of being based onFragments
eases it's addition to the BackStack, whereas I'm not clear how would I do that with aPopupWindow
. Therefore, I'm going for theDialogFragment
approach, although I would still appreciate some deeper details on the comparison of both classes. – Kinin