簡體   English   中英

畢加索不顯示畫廊中的照片

[英]picasso does not display photos from the gallery

我想用畢加索把圖庫里的照片加到imageView上,但是不顯示,顯示網上的照片,不顯示用相機拍的

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

}

在高 API 級別設備中。 您需要在 Manifest Application 標簽中添加這一行

android:requestLegacyExternalStorage="true"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM