【发布时间】:2016-02-05 10:24:04
【问题描述】:
我有一个意图,可用于允许用户在图像应用程序中选择一些图像,如厨房(或用户设备中存在的任何其他图像)。
我希望用户选择仅 10 张图片,但我不知道如何在意图上设置此最大值。 我尝试查看是否可以使用 ClipData,但 clipdata 没有设置最大项目数的方法。
ClipboardManager manager = getSystemService(Context.CLIPBOARD_SERVICE)
ClipData clipdata = manager.getPrimaryClip();// in short whether i get
or i create a clipdata, there are no methods to set maximum number of
items to be held into that clip
这是我的意图。
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO);
如何限制用户只能选择 10 张照片?
【问题讨论】:
-
极限选择有没有解决方案?
-
@Nikhil 是的。请参阅下面的答案。我忘了发布解决方案。感谢提问
标签: android android-intent android-contentprovider android-image