0

1.I am using Universal Image loader in my android app to load images from network.It is giving problems sometimes when i scroll my list of images in list view.Is there any other alternative for this.? 2.Other thing is in the same app i have to upload images and save them in network. i am compressing images sizes because i need four images side by side like a grid view in one screen.But the images which are uploaded lost their quality. this was a great concern in my app.I think my problem happened while compressing them. how to achieve both quality and compressing ?

i went through this Universal Image loader not working properly with android spinner. any help

Community
  • 1
  • 1
GvSharma
  • 2,632
  • 1
  • 24
  • 30

1 Answers1

1

Square's Picasso library is by far the best library for this, and in particular handles ListView fantastically.

https://github.com/square/picasso

You can also downsample your images when displaying them, without actually modifying the underlying image. (Just reduce how much memory you use to show it.)

I believe Picasso does some of this for you, but if you want more control, check out:

Handling large Bitmaps

Community
  • 1
  • 1
Jay Bobzin
  • 1,020
  • 8
  • 14
  • thank you @Jay Bobzin...can u answer for the second question...where my uploaded images are loosing their quality after compressing. – GvSharma Apr 09 '14 at 17:11
  • I tried to address this with the second half of my post (about downsampling). Reducing the file size almost always involves a loss of quality. But you can reduce the size in memory without reducing the file size to get around memory restrictions. – Jay Bobzin Apr 09 '14 at 17:13
  • You may also need to look into ScaleType for your ImageView, in order to get the larger images to shrink to fit into a smaller view. http://developer.android.com/reference/android/widget/ImageView.ScaleType.html – Jay Bobzin Apr 09 '14 at 17:15
  • but, besides the same thing in ios works fine. i don't know why this rises in android.the quality not an issue there. is it code problem or android os? – GvSharma Apr 09 '14 at 17:17
  • Compression algorithms work the same way on iOS or Android... whether you're talking about jpg or png or whatever. If you are running the same transformation on the same files you will almost certainly get the same results. More likely, you are doing something different on iOS than Android. – Jay Bobzin Apr 09 '14 at 17:19
  • yeah @Jay Bobzin..thanks it is working better than image loader just downloaded jat file and i wrote Picasso.with(context).load(thisItem.getImageUrls().get(0)).placeholder(R.drawable.background_bags). resize(100, 100).centerCrop().into(vh.img); – GvSharma Apr 16 '14 at 11:43