Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing large amount of images in android

I am in the planning stage of making a database application for android phones. One of my requirements is that I be able able to provide offline access for users. I am wondering what would be the most efficient way of storing a large amount of images (around four hundred-several thousand).

Oh, the images have been pre-compressed/optimized for mobile viewing. The 50mb limit on apk for the market won't be a issue.

like image 297
user1055070 Avatar asked Nov 19 '11 08:11

user1055070


2 Answers

You have to develop simple logic.Suppose you have connection then download all images.Now you have two way to access these images while you do not have connection-----

Store all images in data base as blob(But it not feasible to store huge amount 
of data to database)

Second..

Store all images in sdcard(by making a folder in it) and now store link of these
images in data base Table.Suppose you donot have connection then first fetch 
image path from DB Table  then fetch file from sdcard and display
like image 67
Tofeeq Ahmad Avatar answered Nov 12 '22 15:11

Tofeeq Ahmad


I would suggest storing the image files in sdcard and filename/path in sqlite DB. Store files in /Android/data/your.package.name/cache/ directory. When the user deletes the application, the cache folder will be deleted and also all the stored images.

Application build file(apk) size will be less as tofeeqahmad was suggesting.

like image 42
sudeepjha Avatar answered Nov 12 '22 13:11

sudeepjha