Refresh fragment when dialogfragment is dismissed

前端 未结 6 1912
南方客
南方客 2021-02-04 01:01

Is there any way I can detect when a DialogFragment is dismissed, so that i can update its parent fragment?

6条回答
  •  既然无缘
    2021-02-04 01:53

    One way to deal with this is to embed your DialogFragment within an Activity and display the activity as a Dialog, there's a tip in the following link that explains how:

    http://developer.android.com/guide/topics/ui/dialogs.html

    You can use this to update the underlying Fragment because when the Dialog (which is an Activity) is finished, onResume() will be called on the underlying fragment. Add code to update the state of the fragment in the onResume() method and that's all there is too it.

提交回复
热议问题