Question

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?‎

Was it helpful?

Solution

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(..).

OTHER TIPS

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.

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

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top