I'm trying to replace Picasso in my android app with Fresco. However I am unsure of how to simply load a bitmap using Fresco.
With Picasso I would just do the following.
Bitmap poster = Picasso.with(getActivity())
.load(url)
.resize(Utils.convertDpToPixel(WIDTH,HEIGHT))
.centerCrop()
.get();
I have been unable to figure out how to create a Bitmap with this Fresco. Any ideas?
You would use Fresco's image pipeline directly for this:
http://frescolib.org/docs/using-image-pipeline.html
Though if you don't mind my asking - what is the motivation here? Why do you need the Bitmap itself?
As Fresco said:
If your request to the pipeline is for a decoded image - an Android Bitmap, you can take advantage of our easier-to-use BaseBitmapDataSubscriber:
You can not assign the bitmap to any variable not in the scope of the onNewResultImpl method.
http://frescolib.org/docs/datasources-datasubscribers.html#_
My code :
You would use Fresco's CacheKey directly for this: