简体   繁体   English

在Android中存储图像的有效方法

[英]Efficient Way to store images in android

My application requires that when a snapshot is taken it must store in memory and next time when I restart the phone I must get a thumbnail of that photo in list of photos and the full scale photo when I click on it. 我的应用程序要求拍摄快照时,快照必须存储在内存中,下次启动手机时,单击照片时,必须在照片列表中获得该照片的缩略图以及完整照片。

There are 2 ways I know. 我知道2种方法。

  1. Store images directly. 直接存储图像。 Concern here is every time it has to hit directory to get image which takes some time. 这里需要关心的是每次必须打目录才能获取图像,这需要一些时间。
  2. Store all images in single xml. 将所有图像存储在单个xml中。 Concern here is XML will be too big and takes time to parse 这里需要担心的是XML太大了并且需要花费时间来解析

Which is more efficient ? 哪个更有效?

Definitely store the images directly as opposed to in XML. 绝对直接存储图像,而不是XML。 It will take time to read the image from the file system but I wouldn't worry about this taking an excessively long time. 从文件系统读取图像将花费一些时间,但是我不必担心这会花费很长时间。

Read through the android docs on Data Storage for more info: http://d.android.com/guide/topics/data/data-storage.html 阅读有关数据存储的android文档以了解更多信息: http : //d.android.com/guide/topics/data/data-storage.html

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

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