Android 代码实现分享多张图片
时间: 2023-06-06 16:08:24 浏览: 83
很高兴回答您的问题!对于Android代码实现分享多张图片,可以使用以下代码:
```
ArrayList<Uri> imageUris = new ArrayList<>();
File file1 = new File(Environment.getExternalStorageDirectory(),"image1.jpg");
imageUris.add(FileProvider.getUriForFile(this, getApplicationContext().getPackageName() + ".provider", file1));
File file2 = new File(Environment.getExternalStorageDirectory(),"image2.jpg");
imageUris.add(FileProvider.getUriForFile(this, getApplicationContext().getPackageName() + ".provider", file2));
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("image/jpeg");
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
startActivity(Intent.createChooser(intent, "Share images to.."));
```
其中,`ArrayList<Uri> imageUris` 为存储要分享的图片的Uri列表。
希望这可以帮助您,如果您还有任何问题,请随时问我!
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)