0

I'm using SQLite database to store my Android data. How can i store a byte array byte[] in a single cell. Because there are only types as int or strings.

I heard something about BLOB, maybe you can explain it to me?

Another option is to convert the byte array to a string and convert it back when using it. How can I do this?

Tobi F.
  • 299
  • 1
  • 4
  • 8

1 Answers1

1

Byte arrays are directly supported, like the other types, by the ContentValues.put() and Cursor.getBlob() functions.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • But BLOB is suitable only for large byte arrays, right? What about, say, 8 or 16 bytes, that need to be inserted and fetched quickly. – User Jun 30 '20 at 14:31
  • @Ixx There is no lower limit on the size of a byte array. And what else would you use? – CL. Jun 30 '20 at 15:32