Ive been trying to save my image into the SQLite database. But I can't solve it by my own. I've already tried in my opinion everything, but it does not work. So my question is if ive got this method:
private byte[] getBitmapAsByteArray(Bitmap bitmap) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// Middle value is quality, but PNG is lossless, so it's ignored.
bitmap.compress(Bitmap.CompressFormat.PNG, 0, outputStream);
return outputStream.toByteArray();
and i've got this to take a photo and pick image from gallery.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == REQUEST_CAPTURE && resultCode == RESULT_OK){
Bundle extras = data.getExtras();
Bitmap photo = (Bitmap) extras.get("data");
imageView_Fotak.setImageBitmap(photo);
}
else if (resultCode == RESULT_OK && requestCode == PICK_IMAGE){
imageUri_vybrana = data.getData();
imageView_VyberFotku.setImageURI(imageUri_vybrana);
imageView_VyberFotku = getBitmapAsByteArray();
How should I do it to convert my image for example from gallery to a BLOB? What method i should call? I would be very grateful for any help!