Glide couldn't load image that is capturing from camera in some android devices

1k views Asked by At

In my android application , i am capturing image from camera and load it with glide. In some devices it is working properly but some devices like LG Q6 , MI note 4 it doesn't load properly. Please check my code and give some solutions.

In Kotlin File :

val imageURL = "/storage/emulated/0/Pictures/1537536635333.jpg"
Glide.with(activity!!)
     .load(imageURL)
     .into(cameraThumbnailIV)

In XML File :

<ImageView
        android:id="@+id/cameraThumbnailIV"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:scaleType="centerCrop"
        android:src="@drawable/photothumbnail" />
1

There are 1 answers

0
Sdghasemi On

Your image address is not in app files directory so you have to make sure you have the READ_EXTERNAL_STORAGE in order to allow Glide to read the image.

You can also enable Glide logging to find out the culprit:

public class GlideModule extends AppGlideModule {    
    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        // Apply options to the builder here.
       builder.setLogLevel(Log.ERROR);
    }
}