How to share Image from Android App Programmatically Example

Please follow and like us:

share image from android app example

In this example I have explained how to share Image from Android App with simple code. here I also add to share image directly to WhatsApp, Instagram from your Android App. Let’s explore sharing image or picture from Android App Example…

Share Image from Android App Example

add following code in your java file

		File f=new File("full image path");
		Uri uri = Uri.parse("file://"+f.getAbsolutePath());
		Intent share = new Intent(Intent.ACTION_SEND);
		share.putExtra(Intent.EXTRA_STREAM, uri);
		share.setType("image/*");
		share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
		context.startActivity(Intent.createChooser(share, "Share image File"));

Share Image directly to WhatsApp from your app

		File f=new File("full image path");
		Uri uri = Uri.parse("file://"+f.getAbsolutePath());
		Intent share = new Intent(Intent.ACTION_SEND);
                share.setPackage("com.whatsapp");
		share.putExtra(Intent.EXTRA_STREAM, uri);
		share.setType("image/*");
		share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
		context.startActivity(Intent.createChooser(share, "Share image File"));

Share Image directly to Instagram from your app

		File f=new File("full image path");
		Uri uri = Uri.parse("file://"+f.getAbsolutePath());
		Intent share = new Intent(Intent.ACTION_SEND);
                share.setPackage("com.instagram.android");
		share.putExtra(Intent.EXTRA_STREAM, uri);
		share.setType("image/*");
		share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
		context.startActivity(Intent.createChooser(share, "Share image File"));

Hope, you like our simple example of how to share image from android app.

nirav kalola