繁体   English   中英

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

[英]How to hide media files on SD card in Android?

我正在开发一个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();

抱歉,您不能。 存储在外部存储器中的数据是世界可读的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM