从Gallery中选择图像时出现UnsupportedOperationException

时间:2016-02-12 06:20:03

标签: android media unsupportedoperation

在某些情况下,当我尝试从图库中选择图像时,我会收到此错误

  

java.lang.UnsupportedOperationException,未知URI:   内容://媒体/外部/图像/

我选择图片的代码如下:

 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();
            }

0 个答案:

没有答案