SimpleDraweeView has two methods for specifying an image. The easy way is to just call setImageURI.

If you want more control over how the Drawee displays your image, you can use a DraweeController. This page explains how to build and use one.

Building a DraweeController

Pass the uri to a PipelineDraweeControllerBuilder. Then specify additional options for the controller:

1
2
3
4
5
6
7
8
9
10
ControllerListener listener = new BaseControllerListener() {...}

DraweeController controller = Fresco.newDraweeControllerBuilder()
    .setUri(uri)
    .setTapToRetryEnabled(true)
    .setOldController(mSimpleDraweeView.getController())
    .setControllerListener(listener)
    .build();

mSimpleDraweeView.setController(controller);

You should call setOldController when building a new controller. This will allow for the old controller to be reused and a couple of unnecessary memory allocations to be avoided.

More details:

Customizing the ImageRequest

For still more advanced usage, you might need to set an ImageRequest to the pipeline, instead of merely a URI. An example of this is using a postprocessor.

1
2
3
4
5
6
7
8
9
10
11
Uri uri;
Postprocessor myPostprocessor = new Postprocessor() { ... }
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
    .setPostprocessor(myPostprocessor)
    .build();

DraweeController controller = Fresco.newDraweeControllerBuilder()
    .setImageRequest(request)
    .setOldController(mSimpleDraweeView.getController())
    // other setters as you need
    .build();

More details: