I am trying to get an image that I put into an image view. This is my approach:
// Get the image in the image view
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Bitmap myBitmap = mImageView.getDrawingCache();
myBitmap.compress(CompressFormat.PNG, 0, outputStream);
Then I want to insert it into a database:
mDbHelper.createReminder(outputStream);
The DatabaseAdapter looks like this:
public long createReminder(ByteArrayOutputStream outputStream) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_IMAGE, outputStream.toByteArray());
return mDb.insert(DATABASE_TABLE, null, initialValues);
}
When I tried it the app crashed. I think that my statements are somehow faulty. Any ideas???
1 Answer