picasso

Using Facebook's Fresco to load a bitmap

六月ゝ 毕业季﹏ 提交于 2019-11-26 21:15:54
问题 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? 回答1: As Fresco said: If your request to the pipeline is for a decoded image - an Android Bitmap, you can take advantage

OkHTTP and Picasso don't run together

假装没事ソ 提交于 2019-11-26 20:35:38
问题 I use Picasso library in my project to load images ande cache them. It works good without any problem. However, when I try to use OkHttp library to perform data communication with my server (JSON communication), Picasso throws exceptions. I use the following jars : okhttp-2.0.0-RC2, okio-1.0.0, picasso-2.2.0. When I run my project after I add these jars, It crashes with the following : 06-12 11:13:15.824: E/dalvikvm(12105): Could not find class 'com.squareup.okhttp.HttpResponseCache',

How to implement my own disk cache with picasso library - Android?

柔情痞子 提交于 2019-11-26 20:29:54
I'm using picasso library to load images for my app. But I don't how to implement my own disk (sdcard) caching with picasso library. Jake Wharton Picasso uses the HTTP client for disk caching and if one is already configured it will use that instead of installing its own. For the built-in UrlConnection the docs for installing a cache are here: https://developer.android.com/reference/android/net/http/HttpResponseCache.html If you are using OkHttp then you just call setCache: http://square.github.io/okhttp/2.x/okhttp/com/squareup/okhttp/OkHttpClient.html#setCache-com.squareup.okhttp.Cache- @Dax,

Clear Cache memory of Picasso

此生再无相见时 提交于 2019-11-26 20:26:47
问题 I'm trying to clear the cache memory of Picasso via Android coding. Can anyone please help me in this issue..? I have tried using the following code, but this was not useful in my case: Picasso.with(getActivity()).load(data.get(pos).getFeed_thumb_image()).skipMemoryCache().into(image); 回答1: Use this instead : Picasso.with(getContext()).load(data.get(pos).getFeed_thumb_image()).memoryPolicy(MemoryPolicy.NO_CACHE).into(image); 回答2: Remove cache of Picasso like this. public class Clear { public

getting image width and height with picasso library

北城余情 提交于 2019-11-26 20:24:54
问题 i'm using picasso library to download and load images into imageView. now i want to know how i can get image width and height before loading them in imageViews ? i have a listview with an adapter that contains two imageView(one of them is vertical and another is horizontal). depends on image width and height i want to load image into one of the imageviews. 回答1: You can get Bitmap dimensions only after downloading It - you must use synchronous method call like this: final Bitmap image =

Android + Picasso: changing URL cache expiration

给你一囗甜甜゛ 提交于 2019-11-26 18:21:05
问题 I am using Picasso to download and display images in views all accros my application. Those images are changing very rarely (they are considered valid for a few months). Is there a simple way to ask Picasso (or the underlying okHttp) to keep those images on disc for this much time? 回答1: Disk caching happens "below" Picasso inside the HTTP client. In fact, this process is completely transparent. We never explicitly ask for a cached-version or an internet-version, the HTTP client will make the

How to listen for Picasso (Android) load complete events?

女生的网名这么多〃 提交于 2019-11-26 18:04:51
问题 Is there a way to listen for events from Picasso when using the builder like: Picasso.with(getContext()).load(url).into(imageView); I'm trying to call requestLayout() and invalidate() on the parent GridView so it'll resize properly but I don't know how to set a listener or callback. I see that Picasso has error event reporting, but is there a success event? 回答1: You can use a Callback to get onSuccess and onError events. Just add a new Callback to your request like so: Picasso.with(getContext

Saving image from url using Picasso?

只谈情不闲聊 提交于 2019-11-26 16:22:11
问题 I'm trying save an image using API Picasso. To do it I'm trying use Target to save but I can't do this work. How could I do this ? Trying //save image public static void imageDownload(Context ctx){ Picasso.with(ctx) .load("http://blog.concretesolutions.com.br/wp-content/uploads/2015/04/Android1.png") .into(getTarget("http://blog.concretesolutions.com.br/wp-content/uploads/2015/04/Android1.png")); } //target to save private static Target getTarget(final String url){ Target target = new Target(

Using Picasso with custom disk cache

佐手、 提交于 2019-11-26 16:17:27
In Volley library, the NetworkImageView class requires an ImageLoader that handles all the image requests by searching for them inside an ImageCache implementation, the user is free to choose how the cache should work, the location and the name of the images. I'm switching from Volley to Retrofit , and for the images I decided to try Picasso . With the former library, I had a String parameter in each of my items containing the image URL, then I used myNetworkImageView.setImageUrl(item.getURL()) and it was able to determine if image was cached on disk. If the image existed in cache folder, the

Picasso Load image from filesystem

房东的猫 提交于 2019-11-26 16:13:12
Can I use Picasso library to load images from the filesystem? I'm using startActivityForResult to let the user pick a photo from his gallery, and then want to show the selected image. I already have working code to get the image filesystem Uri , but can't get the Picasso.load() method to work. Of course you can. Its actually pretty straight forward: File f = new File("path-to-file/file.png") or File f = new File(uri) Picasso.with(getActivity()).load(f).into(imageView); also Picasso.with(getActivity()).load(uri).into(imageView); works egfconnor Yes you can. Try: Picasso.with(context).load(new