Android Gallery的最大图像选择限制 [英] maximum image selection limit from gallery Android
问题描述
我试图从我的应用程序内部的Gallery内置应用程序中获取图像的Uri.
I am trying to get image's Uri in the Gallery built-in app from inside my application.
所以,我在下面使用Intent,但是它选择了更多图像.
so, I was using the Intent below, but it selected many more image.
我想设置限制.少于3
i want to set limitation. less than 3
@Override
public void onClick(View v) {
Intent intent = new Intent( );
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(Intent.createChooser(intent, "select images"), PICK_IMAGE_MULTIPLE);
}
我该如何解决.
您有什么建议吗?
推荐答案
不幸的是,如 http://developer.android.com/reference/android/content/Intent.html#EXTRA_ALLOW_MULTIPLE ,这是不可能的.
Unfortunately, as stated by http://developer.android.com/reference/android/content/Intent.html#EXTRA_ALLOW_MULTIPLE, this is not possible.
这是布尔值;默认为false.如果为true,则允许实现为用户提供一个UI,在其中用户可以选择全部返回给调用者的多个项目.
This is a boolean extra; the default is false. If true, an implementation is allowed to present the user with a UI where they can pick multiple items that are all returned to the caller.
您必须手动检查返回的数据以查看其是否超过3个项目,如果是,请显示
You'll have to manually check the returned data to see if it's more than 3 items, and if so, show a Toast and let them try again.
这篇关于Android Gallery的最大图像选择限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!