In my project I need to store an image into a sqlite database and also need to retrieve it to show in my android emulator. When I show it directly after decoding the encoded string, which I got from Java class using sockets, the image displays there. But when I store a byte array code of the string into the sqlite database with the datatype blob and then again retrieve it by using the getblob() function it contains a different value and this error occurs:
JAVA.lang.NULLPointerException: Factory returns null.
I need a suggestion to store a bitmap image into a sqlite database and also to retrieve it from the sqlite database.
Setting Up the database
Insert in the Database:
Retrieving data:
Note:
Below is an Utility class which I hope could help you:
Further reading
If you are not familiar how to insert and retrieve into a database, go through this tutorial.