Intent.ACTION_VIEW for Android Image

enter image description here

Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType( Uri.parse("file://" +file.getAbsolutePath()),"image/*"); startActivity(intent); 

I want to display a shared image, delete and install as functionality using Android intent. but my image opens without the share option ......... How do I show the image with the share options?

+7
android android-intent share
source share
2 answers

By default, it will not show options with general and delete. But you can do it manually with Intent and File.

0
source share

try the following code for a generic image

 Intent share = new Intent(android.content.Intent.ACTION_SEND); share.setType("image/*"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file)); startActivity(Intent.createChooser(share, "Share image using")); 
0
source share

All Articles