You can share multiple images to WhatsApp contacts using Intents by using putParcelableArrayListExtra method and passing an image URI ArrayList object.
Code Snippet: Uri uri1 = Uri.parse("android.resource://com.code2care.example.whatsappintegrationexample/drawable/image1");
Uri uri2 = Uri.parse("android.resource://com.code2care.example.whatsappintegrationexample/drawable/image2");
Uri uri3 = Uri.parse("android.resource://com.code2care.example.whatsappintegrationexample/drawable/image3");
ArrayList<Uri> imageUriArray = new ArrayList<Uri>();
imageUriArray.add(uri1);
imageUriArray.add(uri2);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "Text caption message!!");
intent.setType("text/plain");
intent.setType("image/jpeg");
intent.setPackage("com.whatsapp");
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUriArray);
startActivity(intent);
You would see multiple images stack when the Android WhatsApp Activity page is loaded and you select a contact or group!!
![Share Multiple Images with WhatsApp Android Intent Share Multiple Images with WhatsApp Android Intent](https://code2care.org/pages/share-multiple-images-in-whatsapp-using-android-intent/images/Share Multiple Images with WhatsApp Android Intent.png)
Share Multiple Images with WhatsApp Android Intent
Comments:
- Worked like a charm! Thank you!
anon 08 Nov 2020 17:11:43 GMT
- Further comments disabled!
More Posts related to WhatsApp,
- How to know if someone has read your WhatsApp message
- WhatsApp Web escanner
- How to resolve Certificate Expired WhatsApp Error
- Share Multiple Images in WhatsApp using Android Intent
- [Solution] Installing Whatsapp There's insufficient space on the device
- Share Image to WhatsApp with Caption from your Android App
- Can we move apps like WhatsApp, Facebook to external MicroSD card
- WhatsApp Keyboard shortcuts for Mac
- WhatsApp launches WhatsApp Web to Access Messages over web browser
- How to Install WhatsApp application on Mac
- Officially Send WhatsApp message using webpage (html)
- How to send WhatsApp message from your Android App using Intent
More Posts:
- Fix RabbitMQ: AuthenticationFailureException: ACCESS_REFUSED - Java
- [Tutorial] How to Customize Notepad++ Toolbar - NotepadPlusPlus
- SharePoint - The URL is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web. - SharePoint
- How to create alias in macOS - MacOS
- How to install Packages in Sublime Text Editor - Sublime-Text
- Docker Desktop needs privileged access macOS - MacOS
- Building library Gradle Project Info: Downloading services.gradle.org - Android-Studio
- Convert String to LocalDate (using Java 8 Date Time API) - Java