Android picasso image resize
August 19, 2015 12:11 am
We return to the origins of this tutorial series and call the android picasso image resize feature. If this is not used picasso will load the full images. Which will have an obvious impact on the scrolling speed of the android recyclerview image gallery.
CODE AVAILABLE ON GITHUB
You can download the code from github at this link picasso code and then you will need to call the Tag “picasso_with_resize” or else you can run this command
git clone --branch picasso_with_resize https://github.com/mobapptuts/recyclerview_image_gallery.git
CODE DETAILS
Add this line to the dependenceies
build.gradle
compile 'com.squareup.picasso:picasso:2.5.2'
Call picasso from the ImageAdapter
ImageAdapter
@Override public void onBindViewHolder(ViewHolder holder, int position) { File imageFile = imagesFile.listFiles()[position]; Picasso.with(holder.getImageView().getContext()) .load(imageFile) .resize(200, 200) .into(holder.getImageView()); }
RUN & VIEW THE SCROLLING PERFORMANCE
Category: Performance, tutorials