如何在SQLite數(shù)據(jù)庫中存儲圖像在我的應(yīng)用程序中,我從圖片庫上傳一個(gè)圖像,并希望將該圖像存儲在SQLite數(shù)據(jù)庫中。如何在數(shù)據(jù)庫中存儲位圖?我正在將位圖轉(zhuǎn)換為字符串,并將其保存在數(shù)據(jù)庫中。當(dāng)從數(shù)據(jù)庫檢索它時(shí),我無法將該字符串分配給ImageView,因?yàn)樗且粋€(gè)字符串。Imageupload 12.java: public class Imageupload12 extends Activity {
Button buttonLoadImage;
ImageView targetImage;
int i = 0;
Database database = new Database(this);
String i1;
String img;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main5);
buttonLoadImage = (Button) findViewById(R.id.loadimage);
targetImage = (ImageView) findViewById(R.id.targetimage);
Bundle b = getIntent().getExtras();
if (b != null) {
img = b.getString("image");
targetImage2.setImageURI("image");
//i am getting error as i cant assign string to imageview.
}
buttonLoadImage.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
Log.i("photo", "" + intent);
startActivityForResult(intent, i);
i = i + 1;
}
});
}
}
}
}
如何在SQLite數(shù)據(jù)庫中存儲圖像
慕森王
2019-06-20 17:05:31