// Convert image to bitmap
Bitmap src1 = BitmapFactory.decodeFile(R.drawable.fried_chicken);
// Convert bitmap to byte
ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
src1.compress(Bitmap.CompressFormat.JPEG,100,baos1);
byte[] byte1 = baos1.toByteArray();
// Convert byte to blob
Blob blob1 = new SerialBlob(byte1);
When I do this, theres a red line for R.drawable.fired_chicken
. Aren't I supposed to put the path file? Am I missing something? SerialBlob
is also underlined, is this because of the previous error?
FYI: I am decoding an image into bitmap then to blob because I want to save it into a sqlite database.