[英]picasso does not display photos from the gallery
I want to add a photo from the gallery using picasso to imageView, but it is not displayed, photos from the Internet are displayed and those that were photographed from the camera are not我想用毕加索把图库里的照片加到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));
}
}
In High API level devices.在高 API 级别设备中。 you need to add this line in Manifest Application tag
您需要在 Manifest Application 标签中添加这一行
android:requestLegacyExternalStorage="true"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.