Storing Image As A Blob In Filesystem
Solution 1:
You can use Android's cache directory, it's generally located in /Android/data/YOURPACKAGENAME/cache
Use this code to get this path.
final String cachePath = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !isExternalStorageRemovable() ? getExternalCacheDir(context).getPath() : context.getCacheDir().getPath();
Displaying Bitmaps Efficiently check out this example provided by Google, it is very useful if your goal is to cache images from the web. However it is visible to the user and can be easily deleted.
If you want to hide this files from user, you can simply save files without any path, it will be inside data/data/YOURPACKAGENAME, which is hidden from users until user has root access. Example
String FILENAME = "hello_file"; String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();
Solution 2:
yes that folder will be visible to user. But if you are worried that user can delete that folder than hide the folder. To hide the folder begin the name of folder with dot(.) .
Post a Comment for "Storing Image As A Blob In Filesystem"