Agustin Sivoplás Agustin Sivoplás - 2 months ago 27
Android Question

SimpleDraweeView black filckering on replacement image with Fresco

I am trying to replace mutiples images (from local storage) using the same
After a while the black flickering disappear and works well.

See the video: http://sendvid.com/q92ry52l

I am only doing:

mSimpleDraweeView.setImageURI("file://" + imagesList.get(index));


The xml code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/fresco_image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"/>
</RelativeLayout>


I am using 'com.facebook.fresco:fresco:0.13.0'

SimpleDraweeView. How avoid the black flickering?

Thanks

Answer

(full discussion here)

Unfortunately this is a known issue. If you set a new URI, you'll see the placeholder image until the new image is ready. This is especially noticeable when you have large images and you switch them a lot (like in your example).

We are going to fix this at some point in the future (see this pull request). For now, you can manually copy the RetainingDataSourceSupplier implementation from said pull request to your project and use it similar to the MainActivity.java example:

PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder()...
builder.setDataSourceSupplier(retainingDataSourceSupplier);
draweeView.setController(builder.build());