Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从库中拾取图像时出现不支持操作异常_Android_Media_Unsupportedoperation - Fatal编程技术网

Android 从库中拾取图像时出现不支持操作异常

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

在某些情况下,当我试图从图库中选取图像时,会出现此错误

java.lang.UnsupportedOperationException,未知URI: content://media/external/images/

我选择图像的代码如下:

 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对我来说,它也没有显示测试中的任何错误,但由于应用程序是实时的,所以在崩溃报告中声明了错误