毕加索不显示画廊中的照片

ggazkfy8  于 2021-07-04  发布在  Java
关注(0)|答案(1)|浏览(334)

我想在imageview中添加一张使用毕加索的画廊照片,但它不显示,显示来自internet的照片,而不显示从相机拍摄的照片

enter code here

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == IMAGE_PICK_GALLERY_CODE && resultCode == RESULT_OK && data != null && data.getData() != null) {

        image_uri = data.getData();

        Picasso.with(this)
                .load(image_uri)
                .error(R.drawable.defaultimage)
                .into(new Target() {
                    @Override
                    public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                        image.setImageBitmap(bitmap);
                    }

                    @Override
                    public void onBitmapFailed(Drawable errorDrawable) {
                        image.setImageDrawable(errorDrawable);
                    }

                    @Override
                    public void onPrepareLoad(Drawable placeHolderDrawable) {

                    }
                });

    } else {
        //startActivity(new Intent(Main2Activity.this, MyActivity.class));
    }

}
rdrgkggo

rdrgkggo1#

在高级api设备中。您需要在清单应用程序标记中添加此行

android:requestLegacyExternalStorage="true"

相关问题