picasso

Picasso Library and GridView Images

六眼飞鱼酱① 提交于 2019-12-30 09:00:13
问题 I want to build an app that displays images in a gridview by using the picasso library. The images are retrieved by a remote server. Should I make an AsyncTask class or is this class handled by Picasso Library itself? All the picasso tutorials I have seen so far seem a bit vague. Thanks, Theo. 回答1: Its very simple to use picasso lib for loading images in gridview, as demonstrated here, class SampleGridViewAdapter extends BaseAdapter { private final Context context; private final List<String>

Picasso Library and GridView Images

∥☆過路亽.° 提交于 2019-12-30 09:00:11
问题 I want to build an app that displays images in a gridview by using the picasso library. The images are retrieved by a remote server. Should I make an AsyncTask class or is this class handled by Picasso Library itself? All the picasso tutorials I have seen so far seem a bit vague. Thanks, Theo. 回答1: Its very simple to use picasso lib for loading images in gridview, as demonstrated here, class SampleGridViewAdapter extends BaseAdapter { private final Context context; private final List<String>

Android Picasso ImageView - Out of Memory Exception MemoryLeak

落爺英雄遲暮 提交于 2019-12-30 07:15:10
问题 I am new to Android development. I'm trying to download images via HTTP and storing them inside of ImageViews or Drawables. In this example, I am using ImageViews. Initially, I used an AsyncTask to download these images (roughly ~500KB each), however I decided to use Picasso since I've read it is more reliable. In the code below, I have 20 ImageViews. Each of the image url's is an image that is roughly 400KB. However, after loading all of them, I've noticed my getUsedMem() is greater than

Picasso crop to a view

雨燕双飞 提交于 2019-12-28 06:44:13
问题 How would I use picasso to crop an image to an imageview? Default seems to scale it down so the whole thing shows fit seems to stretch it. centercrop by itself breaks. fit centercrop seems to be the same as just fit Thanks 回答1: Try using centerCrop() Picasso.with(mContext) .load(url) .centerCrop() .resize(yourImageView.getMeasuredWidth(),yourImageView.getMeasuredHeight()) .error(R.drawable.error) .placeholder(R.drawable.blank_img) .into(yourImageView); You have to add addOnPreDrawListener

Set image url into listadapter to show images using Picasso

百般思念 提交于 2019-12-25 18:37:33
问题 I have a simple list adapter in which I want to display food images with some text info. Till now I have known that I can do it with libraries like AQuery or Picasso, but I can't figure it out how to implement it after reading a lot of tutorials. I have added Picasso library in my dependencies. Suppose my Image view id is ImgViewFood activity JSONArray jsonArr = jsonObj.getJSONArray("foodnames"); for (int i = 0; i < jsonArr.length(); i++) { HashMap<String, String> food = new HashMap<>();

error in display image from jsonArray to Picasso

我们两清 提交于 2019-12-25 09:21:45
问题 I have this JSON link and I parsed it. But when I click on any item I get all the images. What I want is, when user clicks on an item, I want to see the details of only the item clicked. For example, when I click on imo, I need only the image for imo. How can I solve this problem? this is my module : public class AppShowModule { private List<String> Allimage = new ArrayList<String>(); public List<String> getAllimage() { return Allimage; } public void setAllimage(List<String> allimage) {

Image url changing while cliking onRecyclerView item

孤街浪徒 提交于 2019-12-25 07:27:56
问题 private DisplayImageOptions options; @Override public TaskViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.task, parent, false); options = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(true) .postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap bitmap) { return Bitmap.createScaledBitmap(bitmap,200,200,false); } }) .build(); TaskViewHolder

How to increase speed in Picasso

白昼怎懂夜的黑 提交于 2019-12-25 03:35:22
问题 I'm using Picasso to load images, scale and set to listview item. There is my code: Picasso.with(getActivity()).load(builder.toString()) .config(Bitmap.Config.RGB_565) .into(new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { int width = Double.valueOf(bitmap.getWidth() * 0.75).intValue(); int height = bitmap.getHeight(); Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height); imageView.setImageBitmap(newBitmap); } @Override public void

Save Images locally in Image adapter in android

五迷三道 提交于 2019-12-25 02:52:17
问题 This is a question about image saving in android app. I am trying to make popular movies app of an udacity project.Link - https://docs.google.com/document/d/1gtXUu1nzLGWrGfVCD6tEA0YHoYA9UNyT2yByqjJemp8/pub?embedded=true I have picasso library for image downloading in ImageAdapter-- Here is my ImageAdapter code - package jindal5.mayank.popular_movies_14ce10032_gsc; public class ImageAdapter extends BaseAdapter { private String drawablePrefix; private Context mContext; private ArrayList<String>

Picasso and OkHttp

时光总嘲笑我的痴心妄想 提交于 2019-12-24 16:15:24
问题 A question about a thing that I don't understand: does Picasso use OkHttp as default downloader, or should I configure it by myself? And - if not - why should I use Picasso with OkHttp ? What are the advantages compared to the default Picasso ? Thanks. (currently I'm using Picasso v.2.5.2 ) 回答1: If OkHttp is available in your project, Picasso will use it. If not, Picasso will fall back to HttpUrlConnection . 来源: https://stackoverflow.com/questions/32143949/picasso-and-okhttp