Show dialog from fragment?

前端 未结 7 817
再見小時候
再見小時候 2020-11-30 19:17

I have some fragments that need to show a regular dialog. On these dialogs the user can choose a yes/no answer, and then the fragment should behave accordingly.

Now,

7条回答
  •  醉话见心
    2020-11-30 19:57

    I must cautiously doubt the previously accepted answer that using a DialogFragment is the best option. The intended (primary) purpose of the DialogFragment seems to be to display fragments that are dialogs themselves, not to display fragments that have dialogs to display.

    I believe that using the fragment's activity to mediate between the dialog and the fragment is the preferable option.

提交回复
热议问题