picasso

Use a thumbnail as a placeholder for Picasso

妖精的绣舞 提交于 2019-12-20 09:55:44
问题 From the UX point of view, it will be great to show the user a thumbnail first until the real image completes loading, then showing it to him, but Picasso uses only a resource file as the place holder like: Picasso.with(context) .load(url) .placeholder(R.drawable.user_placeholder) .into(imageView); So, how can I use a thumbnail URL as the placeholder? , and if I should use Picasso twice, then how? An issue is already opened on Picasso's github page with this request, but seems it won't be

Why can't picasso load my url? Always defaulting to onError.

旧城冷巷雨未停 提交于 2019-12-20 07:30:09
问题 Here is the onCreate of myActivity thats gonna use picasso: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String url = "http://s3.amazonaws.com/snappie.watermarks/crssd.png"; sticker = (ImageView)findViewById(R.id.sticker); Picasso.with(getApplicationContext()).setLoggingEnabled(true); FrameLayout camera_layout =(FrameLayout)findViewById(R.id.fragment_container); previewWidth = camera_layout.getWidth(

Canvas: trying to draw too large(144609280bytes) bitmap, at android.view.DisplayListCanvas.throwIfCannotDraw

不打扰是莪最后的温柔 提交于 2019-12-20 06:47:04
问题 I get image from a web service, i do following to display it in imageView. Picasso.with(getApplicationContext()).load(imageURL).fit().centerCrop().into(ivNews); 2 days ago a 2048X1600 resolution images was uploaded on server, and all of sudden app start crashing with this exception Canvas: trying to draw too large(144609280bytes) bitmap There is a possibility that the image uploaded on server was higher than the mentioned resolution, and server can upload more high resolution images in future

Android PICASSO - Image Not Loading into ImageView + Stops all Statements following from occuring

牧云@^-^@ 提交于 2019-12-20 06:11:39
问题 Background: I have a Picasso Statement in my java file, which reads a JSON and then formats that data to the screen. The Issue: Once my JSON has been read, Picasso does not load Image from a URL to the ImageView, instead, it stops all statements after that from occurring, such as setting the text in a TextView The JSON I am reading: { "coord":{ "lon":139.01, "lat":35.02 }, "weather":[ { "id":800, "main":"Clear", "description":"clear sky", "icon":"01n" } ], "base":"stations", "main":{ "temp"

Draw a line on ImageView set by Picasso

时间秒杀一切 提交于 2019-12-20 04:38:41
问题 I am trying to figure out how to simply draw a line on an image that is being set in Picasso. I found that if I simply set the image, given a URI, with Picasso and try to draw paint to it using the following: canvas = new Canvas(bitmap); image.draw(canvas); topEdge = new Paint(); topEdge.setColor(context.getResources().getColor(R.color.blue)); topEdge.setStrokeWidth(5); canvas.drawLine(c1.getX(), c1.getY(), c2.getX(), c2.getY(), topEdge); Then I get a crash saying that the bitmap needs to be

android picasso library add token header

╄→尐↘猪︶ㄣ 提交于 2019-12-20 04:07:06
问题 I have been breaking my brain on this one, I am using Picasso library to load and download images from my server, but now I want to add a header in my download request and I cant seem to find a way of doing it. all i want to do is set a header like : setHeader("Authorization", "Bearer " + token); I use this header in any of my server requests, but cant find a way to add it to the picasso line. Any help would be appreciated, Thanks! 回答1: Picasso uses OkHttp as engine , or it is possible to

Load Image With Picasso to a bitmap first

梦想与她 提交于 2019-12-20 02:47:22
问题 I'm using Picasso. And i want to add the image to bitmap first and then add it to an imageview. I'm using the following line of code that adds an image from gallery with uri and show it on image view. I want to save it on a bitmap first. what should i do: Picasso.with(this).load(uriadress).into(imageView); but i want to save it on a bitmap first. 回答1: Picasso holds Target instance with weak reference. So it is better to hold Target as instance field. see: https://stackoverflow.com/a/29274669

Picasso gives out of memory when load an image

心已入冬 提交于 2019-12-20 02:43:12
问题 I am using Picasso to load images from my server and display them in ImageView. I observes some crash reports from user's phone where Out of Memory Exception happens when Picasso is trying to load an image into ImageView. The stack trace as below: java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444) at

Picasso gives out of memory when load an image

微笑、不失礼 提交于 2019-12-20 02:43:07
问题 I am using Picasso to load images from my server and display them in ImageView. I observes some crash reports from user's phone where Out of Memory Exception happens when Picasso is trying to load an image into ImageView. The stack trace as below: java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444) at

Download image and resize to avoid OOM errors, Picasso fit() distorts image

半城伤御伤魂 提交于 2019-12-19 19:06:27
问题 I am trying to show images in a full screen view and using the following code: // Target to write the image to local storage. Target target = new Target() { // Target implementation. } // (1) Download and save the image locally. Picasso.with(context) .load(url) .into(target); // (2) Use the cached version of the image and load the ImageView. Picasso.with(context) .load(url) .into(imgDisplay); This code works well on newer phones, but on phones with 32MB VMs, I get out of memory issues. So I