android - 从 SD 过滤照片的尺寸或分辨率的操作选择?

标签 android android-intent action photo picker

我从 sd 获取一张照片,开始一个新的 Intent :

Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO); 

这工作太棒了!但在某些情况下,图像尺寸太大,导致移动设备崩溃。如果是正常尺寸的图像不是问题,但我想要一种过滤或避免较大尺寸图像的方法。

最佳答案

尝试使用这个

Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            intent.addCategory(Intent.CATEGORY_OPENABLE);
            startActivityForResult(
                    Intent.createChooser(intent, "Select Picture"), 0);

希望它能有所帮助,它对我有用。

关于android - 从 SD 过滤照片的尺寸或分辨率的操作选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11110976/

相关文章:

android - ffmpeg 无法编译

android - 在某些三星设备上 Intent.putExtra() 崩溃

javascript - 如何组织不修改状态的操作?

java - 警告 : No configuration found for the specified action: in namespace: Form action defaulting to 'action' attribute's literal value

android - 在不使用 android :launchMode ="singleTask" 的情况下在新任务中打开 android Activity

asp.net-mvc-3 - asp.net mvc3 创建一个将始终执行的 Controller 方法

android - 我应该在 onCreate 还是 onRestoreInstanceState 中恢复 savedinstancestate?

java - Android Web View 在平板电脑上看起来很奇怪,但在 Android Studio 的模拟器上看起来很好

java - 如何使用android中的回收器 View 将事件放入日历中

安卓布局( TextView )