Home » Android » Load image with glide using Uri format string

Load image with glide using Uri format string

Posted by: admin November 1, 2017 Leave a comment

Questions:

Good afternoon
_
In Android i save an image and uri from camera using imageUri.getPath() the result is the next String /external/images/media/30838, using glide i want to load local image and if occur any error try to load the image that i previously save previously.

The code work when i try upload the image but when i try upload from ´getPath()´ var always load configured placeholder

Exmple

   Glide.with(context)
                    .load(new File(pet.getLocalUriImage())) -- /external/images/media/30838
                    .placeholder(R.drawable.add_option)
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .animate(R.anim.image_fade_in)
                    .centerCrop()
                    .into(holder.petImage);`

i tried put the prefix ´content:/´ and créate a new File instance but i didn’t make it

any advice thanks in advance

Answers: