Android 从库中拾取图像时出现不支持操作异常
在某些情况下,当我试图从图库中选取图像时,会出现此错误 java.lang.UnsupportedOperationException,未知URI: content://media/external/images/ 我选择图像的代码如下:Android 从库中拾取图像时出现不支持操作异常,android,media,unsupportedoperation,Android,Media,Unsupportedoperation,在某些情况下,当我试图从图库中选取图像时,会出现此错误 java.lang.UnsupportedOperationException,未知URI: content://media/external/images/ 我选择图像的代码如下: try { Intent intent = new Intent(); intent = new Intent(Intent.ACTION_PICK, android.provider.Medi
try {
Intent intent = new Intent();
intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(Intent.createChooser(intent, "Select Image"), PICK_FROM_FILE);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
Toast.makeText(HomeActivity.this, "No Application Found!", Toast.LENGTH_LONG).show();
} catch (Exception e) {
e.printStackTrace();
}
要么它不喜欢
内容://
模式,要么它不喜欢图像的文件类型故意选择gif图像?我也使用相同的代码,对我来说,它没有显示任何错误。@yazhini在某些情况下,intent会抛出这个error@Yazhini对我来说,它也没有显示测试中的任何错误,但由于应用程序是实时的,所以在崩溃报告中声明了错误