Loading image with glide is slow

萝らか妹 提交于 2019-12-05 05:52:40

Just add this when you get image from URL, this code reduces the size of that image

you can also do this,

ByteArrayOutputStream bytes = new ByteArrayOutputStream();

    //save scaled down image to cache dir
    newBitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes);

    File imageFile = new File(filePath);

    // write the bytes in file
    FileOutputStream fo = new FileOutputStream(imageFile);
    fo.write(bytes.toByteArray());

check this example

I used dontTransform() method and it almost saved me a second. Images are loaded to the list really first.

use diskCacheStrategy(DiskCacheStrategy.ALL).

for more visit this Click Here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!