This tutorial describes how to create an android recyclerview grid gallery by converting the original single column gallery to multiple columns. CODE AVAILABLE ON GITHUB You can get the code from here and then you need to Tag multi-column-gallery or else you can run this command git clone --branch multi-column-gallery https://github.com/mobapptuts/recyclerview_image_gallery.git CODE SAMPLES activity_camara_intent.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" […]

Read more

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 […]

Read more

In part 7 of the android performance optimisations for recyclerview image galleries we will be using android glide image library to compare image gallery scrolling performance against the other solutions in this tutorial series. ADD GRADLE DEPENDENCY FOR GLIDE dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:recyclerview-v7:22.0.+' compile 'com.github.bumptech.glide:glide:3.6.0' compile 'com.squareup.picasso:picasso:2.5.2' } CALL GLIDE […]

Read more

In the Android performance with inBitmap tutorial we add the BitmapFactory.Option’s inBitmap flag which can be used for bitmaps that have been evicted from the memory cache but not yet deallocated. This is only supported for android versions Honeycomb or later. Implementation Create a Set of SoftReferenced Bitmaps CamaraIntentActivity private static Set<SoftReference<Bitmap>> mReuseableBitmap; Initialise the […]

Read more

This android video tutorial explains how to create memory cache for android. Using this method will have a dramatic effect on performance for android applications. Implementation Create LruCache final int maxMemorySize = (int) Runtime.getRuntime().maxMemory() / 1024; final int cacheSize = maxMemorySize / 10; mMemoryCache = new LruCache<String, Bitmap>(cacheSize) { @Override protected int sizeOf(String key, Bitmap […]

Read more

This tutorial is about resolving concurrency issues that happen when issuing AsyncTasks when using RecyclerViews in android applications. Get Code You can download the code from github here https://github.com/mobapptuts/recyclerview_image_gallery.git Tag concurrency Or else run this command git clone –branch concurrency https://github.com/mobapptuts/recyclerview_image_gallery.git Create a class derived from BitmapDrawable public static class AsyncDrawable extends BitmapDrawable { final WeakReference<BitmapWorkerTask> taskReference; […]

Read more

In this performance tutorial we use the BitmapFactory.Options inSampleSize for loading smaller images with subsampling therefore saving memory & cpu resources, resulting in more responsiveness especially in scrolling. Method Create a scale factor algorithm private int calculateInSampleSize(BitmapFactory.Options bmOptions) { final int photoWidth = bmOptions.outWidth; final int photoHeight = bmOptions.outHeight; int scaleFactor = 1; if(photoWidth > TARGET_IMAGE_VIEW_WIDTH […]

Read more

Part 2 – Addresses the issue with the bitmaps being loaded from the filesystem in the UI thread by creating asynctask in android which in effect creates a background thread to do the file loading. Steps Create the AsyncTask Class public class BitmapWorkerTask extends AsyncTask<File, Void, Bitmap> { WeakReference<ImageView> imageViewReferences; public BitmapWorkerTask(ImageView imageView) { imageViewReferences […]

Read more

This is part 1 of the android tutorial performance series. We look for a quick and fast solution with testing Picasso image library. It’s mainly a convenience library for downloading images from the internet but also has caching support which we will be looking to use to improve the performance of the recyclerview image gallery […]

Read more