External vs Internal memory storage . What shall i use?

房东的猫 提交于 2019-12-24 09:58:29

问题


I'm using a LazyList version in order to load images . It uses external storage , what is not bad . But in order to not show that files to everyone with a filebrowser in hand , i have thought to use internal memory instead , the max amount of memory for that is (5mB).

What should i do? Are there any other possibilities?‎


回答1:


AFAIK there are no limits on internal memory per application. But, it's true, that this memory usually runs low if users have lots of apps on device so you should not use it for big (or lots of) files.

I'd go with external memory (sd-card) and IF raw access to images is a problem, then I'd:

  1. Encrypt the file. That's heavy and it'll slow things down.
  2. Scramble the file. This involves shifting around the bytes, e.g. moving first 1000 bytes to the end of the file, etc.. You can create your own version of InputStream that does byte-shuffling, and pass it to BitmapFactory.decodeStream(..).



回答2:


Internal memory should be used for small things that you don't want anyone to tamper with. The external memory (usually an SD card) can be accessed by other apps and by the user. As a side note, internal memory is "expensive" and users tend to uninstall apps that take up a lot of internal memory.

With external memory, just make sure you're checking that it is in fact available. The SD card could be missing, ejected, mounted or even non-existant (not all Android devices have that).

Access speeds vary. I know for a fact that some Samsung devices have rather slow external storage while their internal storage is very fast.

An alternative option would be to load your images from the network. That would also allow you to control them should you need to change them in the future. Hosing them on Amazon S3 would cost about a few cents a month.




回答3:


If ou dont want everyone with a filebrowser to see your files, you can make a folder with a dot before it like this "/sdcard/.hidden" But if they toggle display hidden files and folders you less lucky.

heres a link to Android page about storing data

Hope this helps




回答4:


Just a footnote(I don't currently have the enough reputation to add comment). @WinOrWin obviously the thread you are referring to is talking about "memory", RAM while this thread talks about "storage space"(although colloquially people might refer to it as "internal/external memory"). They are not the same thing. (eg. The basic difference between harddrive space and memory).



来源:https://stackoverflow.com/questions/8815974/external-vs-internal-memory-storage-what-shall-i-use

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!