如何将媒体文件隐藏在Android中的SD卡上



我正在开发一个Android应用程序,在这里,我正在下载一些媒体文件,我想将这些文件保留为我的应用程序。文件大小很大,因此无法将其存储在内部存储中,因为它可能会影响电话存储并会创建内存问题。

媒体文件的加密和解密需要更多时间来处理。是否可以将文件存储在外部存储中。我要存储的文件不应由另一个应用程序访问,并且连接到PC时不应可见。

任何帮助将不胜感激。预先感谢。

// get the path to sdcard
File sdcard = Environment.getExternalStorageDirectory();
// to this path add a new directory path
File dir = new File(sdcard.getAbsolutePath() + “/your-dir-name/”);
// create this directory if not already created
dir.mkdir();
// create the file in which we will write the contents
File file = new File(dir, “My-File-Name.txt”);
FileOutputStream os = outStream = new FileOutputStream(file);
String data = “This is the content of my file”;
os.write(data.getBytes());
os.close();

对不起,你不能。存储在外部存储中的数据是可读的。

最新更新