如何从图库中选择多个图像?

时间:2018-05-29 13:33:48

标签: android android-image picker

在我的应用程序中,我允许用户选择多个图像来创建pdf。

问题是用户无法选择超过1张图片。我尝试了很多,但没有得到任何可以帮助我的完美解决方案。

有很多可用的库,但由于某些原因我不想使用它。

我正在寻找仅限原生的解决方案。

请帮帮我。

1 个答案:

答案 0 :(得分:3)

通过额外添加简单:

int RESULT_IMAGE_MULTIPLE = 1; 

Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select pictures"), RESULT_IMAGE_MULTIPLE);