Reputation: 67
My application will work with about 500 pictures - aprox 5Mb. The images will be displayed to the user one by one, among with a question. I would like to know what is the best way to store and access the images.
I am considering the following two options:
Saving the images on sd card. Is there a way to prevent user from seeing / deleting the images?
Saving the image data into database
Upvotes: 2
Views: 465
Reputation: 135
Don't know if this is the best way, but I've done thing the following way (in case the total size of pictures is 5Mb):
If you don't want to store them on SD card (for example, you pack the pictures with your application, not downloading and save them from the internet), so I recommend to put the picture files into the assets
folder.
I suppose each question relates to one or several pictures, so you should use database (sqlite) to save the question text, and the path of relative pictures from the assets
folder.
To display the picture, in an ImageView for example, you should load the Bitmap from the picture file in the assets
folder. You may use a method like ImageUtil.loadBitmapFromAssetNoThrow
in this code.
I think saving the image data into database makes it large and slow to access.
Upvotes: 2