如何存储在隐藏模式下的文件 [英] How to store a file in Hidden mode

查看:104
本文介绍了如何存储在隐藏模式下的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从本地主机到SD卡下载xml文件。我想保存在看不见的模式或隐藏文件的XML。我不知道如何直接存储隐藏文件的文件到SD卡。任何人都可以指导我如何存储隐藏文件。


解决方案

  

MODE_PRIVATE将创建文件(或替换同名的文件),并使其专用于您的应用程序。


 字符串文件名=hello_file;
串串=世界,你好!FOS的FileOutputStream = openFileOutput(文件名,Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();

但是,这将存储在手机上存储的文件。你不能让私人文件的SD卡上,因为每个应用程序可以访问SD卡也将相同的权限。

I am downloading xml file from local host to SD card. I want to store that XML in invisible mode or hidden file. i dont know how to store hidden file file directly to SD card. can anyone guide me how to store hidden files..

解决方案

MODE_PRIVATE will create the file (or replace a file of the same name) and make it private to your application.

String FILENAME = "hello_file";
String string = "hello world!";

FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();

But this will store the file on the phone storage. You can't make private file on the sd card because every application has access to the sd card will the same privileges.

这篇关于如何存储在隐藏模式下的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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