-2

I have an image in my @drawable/myimage.jpg of which I would like to load on my ImageView through Glide. Glide however, only accepts Uri's to load the actual image to the ImageView.

Here's the code:

uriImage  =   Uri.parse("@drawable/myimage.jpg");


//LOADS IMAGES USING GLIDE
Glide.with(AboutActivity.this).load(uriImage).into(imgView);

It somewhat doesn't work. Is there any work-arounds this?
Sorry for being naive, I just started using Android Studio again :)

Rahul Singh Chandrabhan
  • 2,531
  • 5
  • 22
  • 33
John Reign
  • 17
  • 6
  • ```Glide.with(context).load(R.drawable.myimage).into(imageView);``` Does this help? Check this for more info https://stackoverflow.com/a/29987915/726625 – sha May 04 '18 at 03:42
  • @sha Much more simpler answer! Thanks! :D – John Reign May 04 '18 at 03:49
  • Possible duplicate of [How to get path to res.drawable folder to copy a file?](https://stackoverflow.com/questions/30045988/how-to-get-path-to-res-drawable-folder-to-copy-a-file) – ADM May 04 '18 at 04:35

2 Answers2

0

try this code:

String imageUrl = getURLForResource(R.drawable.personIcon);
// Load image
 Glide.with(patientProfileImageView.getContext())
      .load(imageUrl)
      .into(patientProfileImageView);

it helps you

Android Geek
  • 8,956
  • 2
  • 21
  • 35
0

Simply do this!

Glide.with(AboutActivity.this).load(R.drawable.resouce_name).into(imgView);
Rishabh Saxena
  • 1,765
  • 15
  • 26