Since onAttach(Activity) has been deprecated on SDK 23, which is the best method in the Fragment lifecycle for checking if an Activity is implementing an interface?
this code is no longer right and in the future this method could even be removed.
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof OnInterfaceOfFragmentListener)
mCallback = (OnInterfaceOfFragmentListener) activity;
else
throw new RuntimeException("OnInterfaceOfFragmentListener not implemented in activity");
}