10

I want to store sample images. what is the best efficient way weather to store on SD card or in DB?

RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166
AZ_
  • 21,688
  • 25
  • 143
  • 191

1 Answers1

8

if the images are not big(2-3 KB) and the collection of them is not supposed to be expanded then you can save them to db. But it would be harder to write them, read them. On the other hand the user won't be able to do anything with them.

Otherwise, if you want to let user to expand the image collection or the images are rather big you should store them to sd card.

Anyway, you should be aware of space lackness and treat those cases appropriately.

Vladimir Ivanov
  • 42,730
  • 18
  • 77
  • 103
  • Well I have a medium size of image collection and I saved them in DB by compressing them, thats saves my space and it proving to be more faster than disk I/O. – AZ_ Jan 04 '11 at 09:02
  • @Aizaz :how did you compress the images? can you give some lead on it? – jithinroy Apr 26 '11 at 09:33
  • yes bro you can use their default compression, you just tell them that how much quality you want. if you give 75 it means 25% your image will be compressed. but it takes lot of time to get images from DB it would be better if i had stored them in my app. – AZ_ Apr 27 '11 at 04:21
  • 2
    reading writing from db is gona cause u too much processing cost. before I put my images on db my app was consuming 8% to 12% battery and after that it is consuming upto 24% battery. and if user gona know that your app is draining his battery he would surely uninstall your app. – AZ_ Apr 27 '11 at 04:22
  • http://developer.android.com/reference/android/graphics/Bitmap.html compress(Bitmap.CompressFormat format, int quality, OutputStream stream) – AZ_ Apr 27 '11 at 04:24