user15088835
user15088835

Reputation:

RecyclerView with Gridlayoutmanager extremely slow to load and respond

I am building an app which shows a gridview of 2 columns, with the help of recyclerview. My code is as follows:

All my vector assets are of size:

android:width="512dp"
android:height="512dp"
android:viewportWidth="512"
android:viewportHeight="512">

The problem is that , when I run the app it takes so long to load, and the device keeps on freezing. I have no clue as to why this is happening. How do I fix this?

Upvotes: 1

Views: 724

Answers (2)

Learning from masters
Learning from masters

Reputation: 2782

Following @Faisal recommendation, here I show the steps:

1.) Add the following dependencies intro build.gradle module:

implementation 'com.github.bumptech.glide:glide:4.12.0'
// Glide v4 uses this new annotation processor -- see https://bumptech.github.io/glide/doc/generatedapi.html
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

2.) To load the picture:

    Glide.with(yourimageview.getContext())
            .load(Your string path or uri to the photo)
            .into(yourimageview);

Too me it worked! Now it's really fast

Upvotes: 0

Faisal Khan
Faisal Khan

Reputation: 382

Use image processing libraries like Glide to load images into imageview . That might help

Upvotes: 1

Related Questions