我正在从画廊中获取图片,并为其设置imageView,并且它可以工作,现在我想以String或Integer格式将图像存储在数据库中,以便以后使用,我的意思是这样的: int myImg = itemPic.getDrawable();
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != RESULT_OK) {
return;
}
if (requestCode == 1) {
final Bundle extras = data.getExtras();
if (extras != null) {
//Get image
Bitmap ProfilePic = extras.getParcelable("data");
itemPic.setImageDrawable(new BitmapDrawable(getResources(), ProfilePic));
}
}
}