picasso

How to retrieve images from cache memory in picasso?

一个人想着一个人 提交于 2019-11-27 06:17:03
问题 I am using picasso library for loading images .In default picasso, It uses internal cache memory for loading images.But as per my app configuration ,i have to use external cache memory(Cache on Disk). so i used this code for Cache on Disk File httpCacheDir = new File(getApplicationContext().getExternalCacheDir(),"http"); long httpCacheSize = 10 * 1024 * 1024; // 10 MiB HttpResponseCache.install(httpCacheDir, httpCacheSize);} Picasso is flexible. So now it caches images in external Sd card..

Fetch images with Callback in Picasso?

删除回忆录丶 提交于 2019-11-27 05:50:27
问题 I want to show a photo series with no gaps in-between the photos, where photos change in a regular interval. I realized Picasso initializes the ImageView before it starts downloading, and it always does that, no matter if I fetch() or not before calling into(). I fetch() to keep the gap between images small and also use .placeholder(R.color.black), but the gap is still visible, even when the image is loaded from memory. My code looks like this Picasso.with(getContext()).load(url).fetch();

RecyclerView laggy scrolling

只愿长相守 提交于 2019-11-27 05:47:47
问题 I am loading 400x200 images in RecyclerView, but scrolling is laggy on 2k devices. I am using Picasso for loading images from resource. As you can see in the demo images are blurry on 2k screen, but if I load higher resolution images the situation gets worse. How to fix this, I am not even loading large image, its 400x200 ? Demo Here is my code card_view.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"

How to load a Bitmap with Picasso without using an ImageView?

血红的双手。 提交于 2019-11-27 05:19:29
问题 With ImageView , I can use the following code to download image with callback Picasso.with(activity).load(url).into(imageView, new Callback() { @Override public void onSuccess() { // do something } @Override public void onError() { } ); Or simply get the Bitmap from this Picasso.with(activity).load(url).get(); . Is there anyway to add callback for just download the image? If possible please provide sample code, Cheers! 回答1: You can create a Target and then modify the Bitmap inside the Targets

Picasso load drawable resources from their URI

◇◆丶佛笑我妖孽 提交于 2019-11-27 04:44:30
I have to show a drawable from res into an ImageView . In this app, I'm using Picasso for some reasons. In this case, I need to load the drawable using its URI and not its id. To do that, here is my code: uri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"+context.getPackageName()+"/drawable/" + drawableName); where drawableName used here are file names rather than their resource ids. Then Picasso.with(context).load(uri).into(imageView); I know for sure that drawable name is correct, but Picasso seems it does not like this uri. If the images is in your drawable folder then you can

Using Picasso library with ListView

血红的双手。 提交于 2019-11-27 04:42:15
What I'm trying to do is adapt my custom ListView adapter to use images fetched from the web by the Picasso library. I believe I have my adapter changed in order to accept an image from Picasso, but I am unsure how to change my implementation to accept it using a ListView. I believe I have to access holder.imageIcon, but I am not sure how to get it up and running. My code is as follows. History.java public class History { public String score; public String gametype; public Picasso icon; public History() { super(); } public History(String score, String gametype, Picasso icon) { super(); this

How can I use Picasso to add icon to Marker?

若如初见. 提交于 2019-11-27 04:31:30
问题 I would like to use Picasso to retrieve the Bitmap image to use as a marker icon but I am not sure how to do so. If I am using Picasso to insert an image into an image view, I know I can use: Picasso.with(MainActivity.this).load(URL).into(photo_imageview); Of course this will not work if I pass it to .icon() Is there a simple way to achieve this? Thanks to anyone taking a look at this! 回答1: Picasso provides a generic Target interface you can use to implement your own image destination.

Load images from disk cache with Picasso if offline

会有一股神秘感。 提交于 2019-11-27 04:05:09
I have some images that I download from different web sites when the app starts, by doing this: Picasso.with(context).load(image_url).fetch(); Now, suppose the user closes the app and turns offline. When the app starts again, Picasso display the images in this way: Picasso.with(ctx).load(image_url).placeholder(R.drawable.ph).into(imageView); The problem is that some images are loaded from the disk cache (yellow triangle in debug mode), and for the others Picasso shows the placeholder. Why? I'm expecting that every image is loaded from the disk cache. You can use this code by this strategy

How to load image from SD card using Picasso library

被刻印的时光 ゝ 提交于 2019-11-27 03:48:54
问题 i need to load images from the Sd card into gridview. For efficiency i'm using Picasso Library Picasso.with(activity).load(images.get(position).getDataPath()) .resize(96, 96).centerCrop().into(viewHolder.image); I used the following code in the adapter. unfortunately m unable to see any images so please can any one help. Note And also can anyone suggest any efficient image loading library to load the images from the sd card. Requirement I dont to load the image every time when scrolling. If

android: create circular image with picasso

徘徊边缘 提交于 2019-11-27 02:59:16
The question had been asked and there had been a promise made for the very version of Picasso that I am using: How do I send a circular bitmap to an ImageView using Picasso? I am new to Picasso and only thing I have used is Picasso.with(context).load(url).resize(w, h).into(imageview); I have already found https://gist.github.com/julianshen/5829333 but I am not sure how to combine it with the line above in a non-awkward way. Anirudh Sharma Research a bit before as there are answers available. Anyhow, follow This Link and read it carefully to know how to use it. try this: import com.squareup