I want to save an image in an ImageView to the database using R.id not R.drawable because the image can change(because its a camera picture). l can not use the path to the image to save because the gallery might be tampered around with.
HotOrNot entry = new HotOrNot(this); byte[] image4 = HotOrNot.getBytes(BitmapFactory.decodeResource(null, R.id.imageView2)); entry.open(); entry.createEntry(image4); entry.close(); public static byte[] getBytes(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0, stream); return stream.toByteArray(); }