@Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

    mSpinnerEntries =
        new Entry[] {
          new Entry(
              R.string.format_pjpeg_label_small,
              sampleUris().createSampleUri(ImageUriProvider.ImageSize.L)),
          new Entry(
              R.string.format_pjpeg_label_medium,
              sampleUris().createSampleUri(ImageUriProvider.ImageSize.M)),
          new Entry(
              R.string.format_pjpeg_label_large,
              sampleUris().createSampleUri(ImageUriProvider.ImageSize.S)),
          new Entry(R.string.format_pjpeg_label_slow, sampleUris().createPJPEGSlow()),
        };

    mImageView = view.findViewById(R.id.image);

    mDebugOutput = (TextView) view.findViewById(R.id.debug_output);
    mDebugOutputScrollView = (ScrollView) view.findViewById(R.id.debug_output_scroll_view);

    final SwitchCompat switchProgressiveRenderingEnabled =
        (SwitchCompat) view.findViewById(R.id.switch_progressive_enabled);
    switchProgressiveRenderingEnabled.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mProgressiveRenderingEnabled = isChecked;
          }
        });

    mProgressiveRenderingEnabled = switchProgressiveRenderingEnabled.isChecked();

    final Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
    spinner.setAdapter(new SimpleUriListAdapter());
    spinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            final Entry spinnerEntry = mSpinnerEntries[spinner.getSelectedItemPosition()];
            setImageUri(spinnerEntry.uri);
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });
    spinner.setSelection(0);
  }
Progressive JPEG example that logs which frames of a progressive JPEG are rendered
samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imageformat/pjpeg/ImageFormatProgressiveJpegFragment.java