GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(getResources());
GenericDraweeHierarchy hierarchy = builder
.setFadeDuration(300)
.setPlaceholderImage(new MyCustomDrawable())
.setBackgrounds(backgroundList)
.setOverlays(overlaysList)
.setActualImageFocusPoint(focusPoint);
.build();
mSimpleDraweeView.setHierarchy();
mSimpleDraweeView.setImageBitmap(bitmap);
How can I get Uri for dynamically created bitmap.As I don't want to save Image to get the uri of the bitmap.
Help me how to do it.
Where do you get the bitmap from? You shouldn't be using setImageBitmap, but I need more context in order to answer the question.
I have created a class that takes bitmap from camera and then return bitmap after some manipulation like filters,resize,etc.In this way I get Bitmap to set on a SimpleDraweeView
Fresco manages Bitmaps on its own, and it does not support providing Bitmap instances created elsewhere. This is necessary because of how Fresco manages memory.
You could save the modified image to disk and then just normally load it with Fresco.
Alternatively, you could create a BitmapDrawable out of your Bitmap and set it as a placeholder to the SimpleDraweeView (You will also need to set the null url). With this approach however you lose all the memory benefits that Fresco provides and you may run into memory issues.
As we know , Fresco can't resize png and the performance of loading a lot of gifs is bad for it will load the gifs and not caching them. So I desperately wanna resize the png and get the first frame of gifs and load the bitmap by fresco. But we can't do it.
@My code uses a generated BitmapDrawable, relative to onscreen content, and its really maddening that that I can't simply set it on the Drawee. Enough so that I am about to rip out Fresco from my app.
You can supply a custom DrawableFactory that just returns your BitmapDrawable. Example for Keyframes: https://github.com/facebook/fresco/blob/master/samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imageformat/keyframes/KeyframesDecoderExample.java#L165
Most helpful comment
As we know , Fresco can't resize png and the performance of loading a lot of gifs is bad for it will load the gifs and not caching them. So I desperately wanna resize the png and get the first frame of gifs and load the bitmap by fresco. But we can't do it.