Is there any way I can detect when a DialogFragment is dismissed, so that i can update its parent fragment?
I just solved this in my project. What I have is an activity with a ListFragment. In that list fragment, when a particular item is clicked, I display a DatePickerFragment (a custom DialogFragment that displays a DatePickerDialog). When a date is selected, I want the ListFragment to be refreshed.
To achieve this, in the activity that hosts the ListFragment (and it also hosts the DatePickerFragment, as a matter of fact) I implemented a method that simply replaces the ListFragment with a new instance, like so:
public void criteriaChanged()
{
getFragmentManager().beginTransaction()
.replace(R.id.container, new FilterFragment())
.commit();
}
I call this method from the DatePickerFragment, from onDateSet():
FilterActivity fa = (FilterActivity) getActivity();
fa.criteriaChanged();
This does the trick for me.