1

I'm Using a ViewPager in my project and so far i found Volley to be very good at loading in the images for the individual pages.

Volley needs com.android.volley.toolbox.NetworkImageView and TouchImageView needs com.android.touch.TouchImageView for ImageView in the xml

My question is how i do combine both of these

I cant get the zoom to work when using Volley

Or i can get the zoom to work by loading in standard bitmaps but swapping pages is slow with that and i'm not that experienced with Bitmaps cashing etc hence why i need volley for the easy of use.

Is there a way to get both of these to work together.

My Pager code

enter image description here

Thanks

UPD

I noticed in touch view class public class TouchImageView extends ImageView {

I wonder if changing to public class TouchImageView extends NetworkImageView { would make it work.

but i moved on since i asked the Q and now use uni image loaded instead. Just out of interest Ill give this a go at some stage and report back. It may be that simple

Tasos
  • 5,321
  • 1
  • 15
  • 26

1 Answers1

1

Well if you are sure the issue is with this line:

Bitmap bitmap = BitmapFactory.decodeByteArray(entry.data, 0, entry.data.length);

then you can run this in an AsyncTask and that'll be better I think.

But I suggest you using Picasso library for image loading, because there are many articles out there that say Picasso is faster in image loading and handles all the hard work itself (caching and...).

Then you can use TouchImageView with Picasso.load(urlString).into(touchImageView);

Amin
  • 1,034
  • 10
  • 17
  • I tried Picasso and universal image loader and it was the same. I would have thought it will be faster loading in the images being in cache but there was a pause of a few seconds. It comes down to how large is the image is so small ones would be ok but full hd or 4k is a problem. with volleys NetworkImaveView no problem so i would like to be able zoom too – Tasos Aug 24 '15 at 22:12
  • So you're telling that in your case `Picasso` has problem loading high-resolution (4K for example) images? That's not right at least for me! I think the problem is with `TouchImageView` as mentioned [here](https://github.com/MikeOrtiz/TouchImageView/issues/71) .`TouchImageView` doesn't handle large images well! So I suggest you using Chris Bane's [PhotoView](https://github.com/chrisbanes/PhotoView) with almost the same features as `TouchImageView` which I have used and can confirm has no problem with large images. – Amin Aug 25 '15 at 05:07
  • I just tried Photoview and it looks fast. I also downloaded the universal image loader full demo from github and the viewpager demo looks promising. i try and combine the zoom and get back to you. thanks – Tasos Aug 25 '15 at 09:45
  • Ok i just tested with uni img loaded and touchview with 4k images. Looks good and fast so i will use that. Thanks for your help – Tasos Aug 25 '15 at 10:35