我想在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));
}
}
1条答案
按热度按时间rdrgkggo1#
在高级api设备中。您需要在清单应用程序标记中添加此行