I'm using 'Glide' to load image from a server to an ImageView. I would like to know if it's possible to extract that URI from the imageview itself.
ImageView contentImage = (ImageView) findViewById(R.id.contentImage);
........
Glide.with(getApplicationContext()).load(contentImageUrl)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(contentImage);
My aim is to share the image in Imageview. How to get URI on imageview with Glide?
Uri uri = ??????????????
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "Share Image"));
to get Uri change ur
Glide
implementation to:Now call the method;
in
getImageUri
function:You need to add permission in manifest:
Also for runtime permission: Api>=23