文件操作

来源:互联网 发布:java逻辑思维面试题 编辑:程序博客网 时间:2024/06/05 17:26

文件操作

FileOutputStream outStream = context.openFileOutput(filename,mode);outStream.write(content.getbyes());outStream.close();

保存在data/data/<package>/files

模式: Context.MODE_PRIVATE私有

          Context.MODE_APPEND追加

Context.MODE_WORLD_READABLE其他应用读取

Context.MODE_WORLD_WRITEABLE写入    以上可以相加

 

快速得到files文件夹this.getFileDir(); 类似得到cache文件夹getCacheDir();

SDCARD:getExternalStorageDirectory();

判断sdcard是否存在
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))


原创粉丝点击