Is there any way I can detect when a DialogFragment is dismissed, so that i can update its parent fragment?
I tried @Gazer answer, it doesn't work for me, I am using different fragment class
import android.app.Fragment;
But I got this working
Create an interface class
public interface MyDialogListener {
void OnCloseDialog(Object obj); //you can put any object here
}
Implement the interface class in the Parent Fragment
public class ActionBarFragment extends Fragment implements MyDialogListener{
@Override
public void OnCloseDialog(Object obj) {
//Do you refresh
}
and then I add the listener inside the DialogFragment
public class SpecialDialogFragment extends DialogFragment {
MyDialogListener mListener;
public SpecialDialogFragment(MyDialogListener listener) {
this.mListener = listener;
}
@Override
public void onStop() {
super.onStop();
if(mListener!=null)
mListener.OnCloseDialog(null);
}