Search code examples
androidimageactionsend

Android - Intent.Action_Send send multiple images without showing chooser dialog multiple times


In my App, I am creating a bitmap at run time and letting the user to share it. I am using ACTION_SEND to share the bitmaps (images). It works great but I have noticed that, few Apps like Whats App etc., reduces the image quality (if more than 100 KB) and the end user gets a blurry image. If I opt to choose Email client like Gmail then the image looks good at the receiving end. I am aware that WhatsApp compresses the picture so to overcome this issue I am thinking of sending multiple images instead of one big image.

What I want is, If the APP has to sent three images, It should ask user only once to select the application that should be used to send the image and then within the code, I would identify which Application user has selected and then using the same application will send the remaining two images.

Thanks


Solution

  • I luckily figured out my self

    Here is the code

    Intent shareIntent = new Intent();                                      
    
    shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
    
    ArrayList<Uri> files = new ArrayList<Uri>();
    files.add(bmpUri1);  // uri of my bitmap image1
    files.add(bmpUri2); // uri of my bitmap image2
    shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files);