How to save and retrieve PDF file using room database

Viewed 644

I have saved files in my phone directory at this location /storage/emulated/0/Papers/aw23xdr.pdf I Want to add this file in room database and retrieve back.

Is it possible to do so?

1 Answers

Instead of storing file directly you should store the PDF files in the file system of android(app specific local storage) and just save the file path in the Room DB. BTW Room support BLOB storage in it so ideally you can convert file in bytes array and then store it in Room DB as a BLOB

Related