簡體   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