简体   繁体   English

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

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

I am developing one android application, here I'm downloading some media files and I want to keep the files as private to my application. 我正在开发一个Android应用程序,在这里我正在下载一些媒体文件,并且希望将文件保留为我的应用程序私有。 The files size are very large, so it's not possible to store it in internal storage because it may affect phone storage and will create memory issues. 文件很大,因此无法将其存储在内部存储中,因为它可能会影响手机存储并会造成内存问题。

Encryption and decryption of the media files takes more time to process. 媒体文件的加密和解密需要更多的时间来处理。 Is it possible to store the files as safe in external storage. 是否可以将文件安全存储在外部存储中。 The files I want to store should not be accessed by another applications and when connected to pc it should not be visible. 我要存储的文件不应由其他应用程序访问,并且连接到PC时不应显示。

Any help would be appreciated. 任何帮助,将不胜感激。 Thanks in advance. 提前致谢。

// 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();

Sorry, you cannot. 抱歉,您不能。 Data stored in external storage is world-readable. 存储在外部存储器中的数据是世界可读的。

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

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