从图库'文档中选择图像时,会停止'错误显示

问题描述 投票:0回答:1

我正在使用此代码从图库中获取图像。

Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent, "Select File"), REQUEST_IMAGE_CAPTURE_GALLERY);
java android
1个回答
0
投票

试试这个:

  Intent intent = new Intent(Intent.ACTION_PICK);
  intent.setType("image/*");
  startActivityForResult(intent, IMAGE_CODE);

IMAGE_CODE是一个常量int值

© www.soinside.com 2019 - 2024. All rights reserved.