This is related to my previous question: Open the DialogFragment dialog from CustomView
Now I need to use a callback to return a value from my dialog box. I understand that something like this is usually done:
public class MyDialogFragment extends DialogFragment { public interface onMultipleSelectionFragmentCloseListener { public void onMultipleSelectionFragmentOkay(); } onMultipleSelectionFragmentCloseListener mListener; @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (onMultipleSelectionFragmentCloseListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement onMultipleSelectionFragmentCloseListener"); } } ....
This is the case when you want an Activity to execute and receive a callback. But, if I want a custom view to do this (e.g. in my previous question)?
source share