picasso

BaseAdapter and Picasso issue

倾然丶 夕夏残阳落幕 提交于 2019-12-02 07:12:37
I am having a problem loading images in ListView from a server with Picasso. I have a BaseAdapter that is used to fill my ListView. In this ListView some items have an image and some not. in this method: public View getView(final int position, View convertView, ViewGroup parent) { I do: ... //context = Activity context; //context1 = Context context1; context1 = context.getApplicationContext(); if (!photo[position].equals("")) { String stringurl = "http://www.blablabla.it/img/"+photo[position]+".jpg"; Picasso.with(context1) .load(stringurl) .placeholder(R.drawable.white) .into(holder.imageD); }

Crop image as square with picasso

我的梦境 提交于 2019-12-02 04:06:26
问题 How can I crop image to square using picasso library on Android? I need following: cat one and cat two 回答1: The following project provides a lot of different transformations for Picasso https://github.com/wasabeef/picasso-transformations The one you are interested is named CropSquareTransformation and you can apply it by using the following code Picasso.with(mContext) .load(R.drawable.demo) .transform(transformation) .transform(new CropSquareTransformation()) .into(holder.image); You could

how to resize an image without being blurred , or with using picasso

丶灬走出姿态 提交于 2019-12-02 02:36:32
I need help in improving my code . What I am doing : There is a button in main activity, when clicked , user choose the image , after that, the image is passed through an intent to another activity(add_image.java) and displayed in an image view , after that I send the image to the server. My problems :1) I want the best way to send the path image to second intent then convert it into image 2) then compress it as much as I can without loosing a lot of its quality. the image size now is 376kb . so in my my app Ill displaying several images so in such size it will consume time and internet to

Crop image as square with picasso

▼魔方 西西 提交于 2019-12-02 00:40:41
How can I crop image to square using picasso library on Android? I need following: cat one and cat two The following project provides a lot of different transformations for Picasso https://github.com/wasabeef/picasso-transformations The one you are interested is named CropSquareTransformation and you can apply it by using the following code Picasso.with(mContext) .load(R.drawable.demo) .transform(transformation) .transform(new CropSquareTransformation()) .into(holder.image); You could add the dependency or copy and paste the classes you need. Using a custom imageview: public class

how to make picasso display default image when there is an invalid path

落花浮王杯 提交于 2019-12-01 22:16:33
I am having one issue on display a default image name here R.drawable.avatar_placeholder. When the link from webservice is non empty, but error 404. means there isn't any image on that link path. Which if i run this function below, the string "path not empty" is shown, but it failed to display the image. Any suggestion is welcomed. Thanks. private void loadProfileDetails() { Logger.d(UI_LoginFragmentWithPin.class, "loadProfileDetails profile image: " + PrefUtils.readString(Constant.PREF_PROFILE_IMAGE)); if (!TextUtils.isEmpty(PrefUtils.readString(Constant.PREF_PROFILE_IMAGE))){ Utils.println(

Picasso gives out of memory when load an image

[亡魂溺海] 提交于 2019-12-01 21:29:15
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 android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:832) at android.content.res

Android - picasso shows only placeholder, not the image from URL

痴心易碎 提交于 2019-12-01 19:59:22
I've got this code public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView image_view = (ImageView)findViewById(R.id.imageView1); Picasso.with(getApplicationContext()).load("http://nuclearpixel.com/content/icons/2010-02-09_stellar_icons_from_space_from_2005/earth_128.png").placeholder(R.drawable.ic_launcher).noFade().into(image_view); } And i want to view the image from url in my imageview... however instead of the image only the placeholder shows. What may

Picasso image caching

雨燕双飞 提交于 2019-12-01 19:26:00
问题 I want to download the following image downloading code with Picasso image cache. DownloadImage downloadImage = new DownloadImage(); downloadImage.execute(advert.getImgUrl()); private class DownloadImage extends AsyncTask<String, Void, Bitmap> { @Override protected Bitmap doInBackground(String... arg) { Bitmap bmp = null; try { URL url = new URL(arg[0]); bmp = BitmapFactory.decodeStream(url.openConnection() .getInputStream()); } catch (MalformedURLException e) { e.printStackTrace(); } catch

Picasso image caching

≡放荡痞女 提交于 2019-12-01 18:43:31
I want to download the following image downloading code with Picasso image cache. DownloadImage downloadImage = new DownloadImage(); downloadImage.execute(advert.getImgUrl()); private class DownloadImage extends AsyncTask<String, Void, Bitmap> { @Override protected Bitmap doInBackground(String... arg) { Bitmap bmp = null; try { URL url = new URL(arg[0]); bmp = BitmapFactory.decodeStream(url.openConnection() .getInputStream()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); return null; } return bmp; } @Override protected void

Picasso: Unrecognized type of request for HTTP scheme

南楼画角 提交于 2019-12-01 18:03:31
问题 I am loading images synchronously to display notification once the image is loaded. bitmap = picasso.load(imageUrl).get(); It was working fine but today I got an exception: Fatal Exception: java.lang.IllegalStateException: Unrecognized type of request: Request{ http://www.fulbori.com/mp/resources/image/19/17/e.jpg} at com.squareup.picasso.BitmapHunter$2.load(BitmapHunter.java:66) at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:206) at com.squareup.picasso.RequestCreator.get