Lukas Petersson
Lukas Petersson

Reputation: 315

Large string in SQLite database

I am making a book note app. I am saving info about the books like title, author, date etc in an SQLite Database.

But I have 2 questions.

  1. One of the pieces of info is a large String where the user can add notes as write summaries of the book. can this be stored as a String in the database or will that cause problems because the string is so large?

  2. another is an image of the book´s cover. Now I am planning on saving it as an image link and then download it with an Async Task each time the app is opened but is it possible to save the image in the SQLite database?

Thanks!

Upvotes: 0

Views: 1321

Answers (2)

shmakova
shmakova

Reputation: 6426

  1. It's better to save it in TEXT field
  2. Save link in your database and use Glide or Picasso (they can cache your image in easy way) to load your image, not AsyncTask

Upvotes: 2

jbytecode
jbytecode

Reputation: 679

SQLite in Android supports the data types TEXT for String data and BLOB for binary data. Length of TEXT would be enough to handle any data that is already shown in the screen. Images and other binary content can be stored using BLOBs.

Upvotes: 1

Related Questions