简体   繁体   English

在android中存储大量图像

[英]Storing large amount of images in android

I am in the planning stage of making a database application for android phones. 我正处于为Android手机制作数据库应用程序的计划阶段。 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. apk for the market的50mb限制不会成为问题。

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

I would suggest storing the image files in sdcard and filename/path in sqlite DB. 我建议将图像文件存储在sqlcard和sqlite DB中的sdcard和filename / path中。 Store files in /Android/data/your.package.name/cache/ directory. 将文件存储在/Android/data/your.package.name/cache/目录中。 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. 应用程序构建文件(apk)的大小将少于tofeeqahmad的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM