I am storing image as byte array in sqlite database from one project. Then i use the pre-populated table in another project
But the problem is that Bitmap Factory is resulting as null.
Code of storing images:
Bitmap myLogo = BitmapFactory.decodeResource(getResources(), arr[i]);
ByteArrayOutputStream stream1 = new ByteArrayOutputStream();
myLogo.compress(Bitmap.CompressFormat.JPEG, 100, stream1);
b = stream1.toByteArray();
Code of retrieving images:
BitmapFactory.Options options = new BitmapFactory.Options();
decodedByte = BitmapFactory.decodeByteArray(Image, 0,Image.length, options);
System.out.println("Image = " + Image);
System.out.println("decodedByte = " + decodedByte);
Here Image is returning the byteArray(Image) with length 12. But the bitmap(decodedByte) is returning null value.
I have tried a lot of ways but cannot find a solution. please help!