@Override
  public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
    setupImageFormatEntries(sampleUris());

    mButton = view.findViewById(R.id.button);
    mImage = view.findViewById(R.id.image);
    mSizeSpinner = view.findViewById(R.id.spinner_size);
    mFormatSpinner = view.findViewById(R.id.spinner_format);

    mSizeSpinner.setAdapter(new SimpleResizeOptionsAdapter());
    mSizeSpinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            reloadImage();
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });
    mSizeSpinner.setSelection(0);

    mFormatSpinner.setAdapter(new SimpleImageFormatAdapter(mImageFormatEntries));
    mFormatSpinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            reloadImage();
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });
    mFormatSpinner.setSelection(0);

    mImage.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            reloadImage();
          }
        });

    view.getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {
              @Override
              public void onGlobalLayout() {
                ResizableFrameLayout mainImageFrameLayout =
                    (ResizableFrameLayout) view.findViewById(R.id.frame_main);
                mainImageFrameLayout.init(view.findViewById(R.id.btn_resize));

                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                  view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                } else {
                  view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                }
              }
            });
  }
Fragment that illustrates how to use the image pipeline directly in order to create
notifications.
samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imagepipeline/ImagePipelineResizingFragment.java