如何创建私有文件夹在SD卡 [英] How to create private folder in sdcard

查看:160
本文介绍了如何创建私有文件夹在SD卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序用于安全目的。所以,从我的应用程序用户捕获所有的照片都保存在该文件夹不应该从任何其他应用程序访问,不应该给访问时,设备连接到计算机系统中的文件夹中的照片。如果用户要查看这些图片,他应该从我的应用程序只能访问。

My application is used for security purpose. so, from my application user captures photos that all photos are stored in a folder that folder should not access from any other application and should not give access when devices connect to computer system. If user wants to view these images he should access only from my application.

谁能plaese帮我......

can anyone plaese help me......

在此先感谢

推荐答案

根据这一指南,您可以直接保存在设备的内部存储的文件。默认情况下,保存在内部存储的文件是私有的,你的应用程序和其他应用程序不能访问这些文件(也不能在用户)。当用户卸载应用程序,这些文件将被删除。 例如:

According to this guide, you can save files directly on the device's internal storage. By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user). When the user uninstalls your application, these files are removed. For example:

String FILENAME = "hello_file";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();

MODE_PRIVATE将创建文件(或替换同名文件),并使其专用于您的应用程序。其它可用的模式有:MODE_APPEND,MODE_WORLD_READABLE和MODE_WORLD_WRITEABLE

MODE_PRIVATE will create the file (or replace a file of the same name) and make it private to your application. Other modes available are: MODE_APPEND, MODE_WORLD_READABLE, and MODE_WORLD_WRITEABLE.

这篇关于如何创建私有文件夹在SD卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆