Share image and text through whatsapp

I use the following code to exchange images and text through WhatsApp. However, he shares only the image, not the text. I searched all over the internet but could not find a solution.

 String message = Fname + Mobileno + Homeno + Workmail + Homemail
                + Gtalk + Skype + Address + Company + Title + Website;
      Intent shareIntent = new Intent(Intent.ACTION_SEND); 
      Uri uri = Uri.parse("file://"
                + Environment.getExternalStorageDirectory()
                + "/Talk&Share/Images/profpic.png");

      shareIntent.putExtra(Intent.EXTRA_TEXT, message); 
      shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Contact"); 
      if(uri != null){
       shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
       shareIntent.setType("image/plain");
      }else{
       shareIntent.setType("plain/text");
      }

         return shareIntent; 
+5
source share
5 answers

Support for Whatsapp image sharing with text.

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT,title + "\n\nLink : " + link );
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(imageFilePath));
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share image via:"));

This will be the general image, and EXTRA_TEXT will be considered as the signature of the image.

+8
source

Using:

Intent.ACTION_SEND_MULTIPLE

instead:

Intent.ACTION_SEND
+8
source

, WhatsApp . , , , . .

+3

- 2019

 private void shareIntent() {

        Bitmap imgBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher);
        String imgBitmapPath = MediaStore.Images.Media.insertImage(getContentResolver(),imgBitmap,"title",null);
        Uri imgBitmapUri = Uri.parse(imgBitmapPath);

        Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        shareIntent.putExtra(Intent.EXTRA_STREAM,imgBitmapUri);
        shareIntent.setType("image/png");
        shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        shareIntent.putExtra(Intent.EXTRA_TEXT, "My Custom Text ");
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject text");
        startActivity(Intent.createChooser(shareIntent, "Share this"));
    }

+ WhatsApp , , , , , WhatsApp. , WhatsApp , , ActivityNotFoundException, catch startActivity(intent); WhatsApp intent.setPackage("com.whatsapp");

0
Intent i = new Intent(android.content.Intent.ACTION_SEND);
 i.setType("text/plain");
 i.putExtra(Intent.EXTRA_SUBJECT, "Subject");
 i.putExtra(Intent.EXTRA_TEXT, "Message body");
startActivity(Intent.createChooser(i, "Share dialog title"));
-1

All Articles