1. Are you ready for the Galaxy S20? Here is everything we know so far!

Converting Blob to String in Android Room

Discussion in 'Android Development' started by Guitarist, Jan 27, 2020.

  1. Guitarist

    Guitarist Newbie
    Thread Starter

    I'm having trouble finding information on how to resolve an issue with reading file BLOB data with Android Room.

    The Problem:
    In the database there are 11 tables and one table called Files handles file attachments. There are 3 fields, FileID, Filename, FileData. FileData is the BLOB or byte data stored to build the file. The file can be anything, a picture, text file, Word, Excel, just about anything.

    What I've tried:
    I can't seem to find, if it exists, how I would setup my entity class to manage this field data. I searched on stackoverflow and developer.android.com but haven't discovered anything helpful yet. I did see that there is a method called getBlob() (https://developer.android.com/reference/android/database/Cursor.html#getBlob(int)) but this is related to the Cursor method, which Android Room handles all the Cursors.

    I'm not sure where to go from here, so I was hoping someone may have had the same issue or knew how you would setup your Room code (e.g. Entities, etc) to manage this file data.
     

    Advertisement

Loading...

Share This Page

Loading...