带有视频和文字的 Android ACTION_SEND_MULTIPLE

标签 android video text android-intent share

我正在尝试使用 ACTION_SEND_MULTIPLE Intent 同时共享视频文件和文本。

现在,这在 GMAIL 中有效(附件中的视频和邮件正文中的文本),但是我也想在 Whatsapp 中做同样的事情,但它没有出现在 Intent 的应用程序列表中。

我的代码是下一个:

Intent sharingIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);

sharingIntent.putExtra(Intent.EXTRA_TEXT, "Descarga la app en...");

ArrayList<Uri> contenidos = new ArrayList<Uri>();

File file = new File(Environment
    .getExternalStorageDirectory()
    .getAbsolutePath()
    + "/Talking/"
    + nombreVideo
    + ".3gp");

Uri screenshotUri = Uri.fromFile(file);

contenidos.add(screenshotUri);

//sharingIntent.putExtra(Intent.EXTRA_STREAM,screenshotUri);
sharingIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, contenidos);
sharingIntent.setType("video/3gpp");

startActivity(Intent.createChooser(sharingIntent, "Share video using"));

感谢您的帮助。

最佳答案

由于 whatsapp 的新更新,现在您的代码可以工作了,在此之前它不接受这种 Intent (ACTION_SEND_MULTIPLE),因为它一次只接受一个文件。

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
shareIntent.setType("image/png");    
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM,
    Uri.parse("file:///mnt/sdcard/UserImages/"+ ParseUser.getCurrentUser().getObjectId() + ".png"));    
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Hello test");    
startActivity(Intent.createChooser(shareIntent,"Share"));  

关于带有视频和文字的 Android ACTION_SEND_MULTIPLE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11798660/

相关文章:

MySQL:大型 VARCHAR 还是 TEXT?

css - 如何根据屏幕尺寸css3使文本的边框长度固定为20px而不是动态宽度

ios - 从 CMSampleBufferRef 获取 YUV 用于视频流

ruby - FFmpeg 将 -filter_complex 与拆分过滤器一起使用时提取不同数量的帧

Android Material Chip 主题覆盖

android - 如果 ("a"== "a") 不工作

html - 屏蔽视频 SVG 形状

c - SDL 编写文本

Java创建嵌套数组,一个数组包含一个包含键值对的数组的数组

android - 使文本完全适合屏幕大小