Share image in android:-
File file=new File("full image path");
Uri uri = Uri.parse("file://"+file.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"));
Share image only on whatsapp:-
File file=new File("full image path");
Uri uri = Uri.parse("file://"+file.getAbsolutePath());
Intent share = new Intent(Intent.ACTION_SEND);
share.setPackage("com.whatsapp");
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"));
Share image only on facebook:-
File file=new File("full image path");
Uri uri = Uri.parse("file://"+file.getAbsolutePath());
Intent share = new Intent(Intent.ACTION_SEND);
share.setPackage("write the package name here");
share.setPackage("write the package name here");
share.putExtra(Intent.EXTRA_STREAM, uri);
share.setType("image/*");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(Intent.createChooser(share, "Share image"));
Share image only on instagram:-
File file=new File("full image path");
Uri uri = Uri.parse("file://"+file.getAbsolutePath());
Intent share = new Intent(Intent.ACTION_SEND);
share.setPackage("com.instagram.android");
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"));
Tag:- share image in android, share image on facebook, share image on whatsapp, share image on instagram, share image programmatically, share image example in android.
Comments
Post a Comment
Please comment here if you have any query.