Using java Syntax Highlighting
- //creating blob datatype
- db.execSQL("CREATE TABLE IF NOT EXISTS "+dbTable+"(image BLOB);");
- //getting a sample image from drawable folder inside my project
- InputStream xmlInputStream = this.getResources().openRawResource(R.drawable.abc);
- //convert it into a byte[]
- byte[] bb = (xmlInputStream.toString()).getBytes();
- //try inserting the byte into sqlite
- db.execSQL("INSERT INTO "+ dbTable + "(image)" + " VALUES (\""+bb+"\");");
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
I am able to insert values but when i try retrieving them as byte using decodeByteArray it gives me the following error.
DEBUG/skia(13003): xxxxxxxxxxx jpeg error 53 Not a JPEG file: starts with 0x%02x 0x%02x
The image retrieving query works fine as i have checked retrieving an image previously stored as blob on a sample database.
I have tried storing and retrieving different image files but i am getting the same error.Could any one tell me as how to solve this problem

