I need help with viewpager2 implementation. For so...
# android
e
I need help with viewpager2 implementation. For some reason it's lagging when I swipe (on emulator and on real device as well). Here is the proof:

https://www.youtube.com/watch?v=uoj_PWWUApU

and here is my repo where I reproduced the issue https://github.com/eurbon/viewpager2_lagging can anyone help me?
😶 2
c
Load the images in the background.
setImageResource
is running on the main thread.
e
@Chrimaeon thank you, problem solved! I used glide for loading like this
Copy code
fun bind(myImage: Int) {
    binding.apply {
        Glide
            .with(imageview1.context)
            .load(myImage)
            .centerCrop()
            .into(imageview1)
    }
}
👍 2