1

I have a question about saving images in an SQLite database location in the app.

I made an app for iOS where users can snap a photo or grab an existing one from the app that saves them in a local bank in own app, since the IOS does not have so many problems with disk space.

On Android already have code that takes the photo or use an existing one, now wanted to know how save them in SQLite database. (?)

I've been reading about and some suggest saving the image in SD card and insert into the database only the image path, but if for some reason it is excluded from the SD card will have an error in your application for the path referenced no longer exists.

What would be the ideal solution for this?

3
  • " since the IOS does not have so many problems with disk space." What problems? You do understand that storing the image in SQLite will take at least as much space as "writing it to disk"? Commented Dec 11, 2012 at 19:52
  • Agreed with Simon ^, there's no difference. Commented Dec 11, 2012 at 19:57
  • 1
    I referred to as the aprelhos I use for tests with limited hardware where I only have 100MB of storage without the SD card, and having some installed applications and a couple of images saved in the DB one time or another will give problem ... Already in the minimum IOS memory disk storage is 8GB Commented Dec 11, 2012 at 19:59

2 Answers 2

2

You should only keep the name of the picture in the database and store the picture on the internal storage, not on the sdcard, save them in the first place as private to your application only.

Sign up to request clarification or add additional context in comments.

Comments

1

The ideal solution is to store it in the SD card. Storing in DB won't keep the user from deleting it. You'll also lose this information if the user clears the app data. All databases are deleted when the user does it.

Anyway, if you choose the SQLite solution, you can use a blob field. Remember that some versions of SQLite won't support large blob data. Check this out:

http://effbot.org/zone/sqlite-blob.htm

I also suggest this:

http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.