code: public void finish(int resultCode, Intent data) {
          Activity activity = getActivity();
          activity.setResult(resultCode, data);
          activity.finish();
          setTransition(true);
      }
docs: Finishes current activity with provided result code and data.