title: onAttach(Activity) deprecated: where I can check if the activity implements callback interface
body: <p>Before API 23 I used Fragment's onAttach methods to get my listener instance, then the reference is cleaned inside onDetach. ex:</p>
  
  <pre><code>@Override
  public void onAttach(Activity activity) {
      super.onAttach(activity);
      mListener = null;
      try {
          mListener = (SellFragmentListener) activity;
      } catch (ClassCastException e) {
          throw new ClassCastException(activity.toString()
                  + " must implement SellFragmentListener");
      }
  }
  
  @Override
  public void onDetach() {
      super.onDetach();
      mListener = null;
  }
  </code></pre>
  
  <p>Is it safe to do the same check inside onAttach(Context context) or is there a better way to get the holder activity instance?</p>