Adding 4mb image from URL to imageVIew in android studio

断了今生、忘了曾经 提交于 2019-12-10 11:55:13

问题


I used picasso for loading my images from web into the imageView and it works perfectly for images less than 600 kb but anything above that returns a black imageview meaning that image is not loading. Can I take an image of 1mb or more from URL using picasso? If not, what is the best way to accomplish this.


回答1:


Try Glide.

 Glide.with(context).load(url).placeholder(R.drawable.placeholder).into(imageView);

OR

Glide.with (context).load (url).asBitmap().into(imageView);



回答2:


u want to use picasso try this

 Picasso.with(context)
                .load(foodItem.getImageUrl())
                .memoryPolicy(MemoryPolicy.NO_CACHE )
                .networkPolicy(NetworkPolicy.NO_CACHE)
                .error(R.drawable.logosign)
                .noFade()
                .into(holder.productImage);

  compile 'com.squareup.picasso:picasso:2.5.2'


来源:https://stackoverflow.com/questions/42270474/adding-4mb-image-from-url-to-imageview-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!