在内部存储Android文件未找到 [英] Android File on Internal Storage not found
问题描述
我想写我的应用程序的Android内部存储空间的文件。如此多的试验后,我用这个方法<一终于成功href=\"http://stackoverflow.com/questions/9306155/writing-reading-files-to-from-android-phones-internal-memory\">Writing/Reading文件到/从Android手机的内部存储器。然而,当我去到的数据/数据/包名/文件,我找不到我的包,甚至无法找到MyFile.txt的。事实上,我不能在内部存储器中的任何地方找到他们。这是为什么?
字符串的root = Environment.getExternalStorageDirectory()的toString();
文件f =新的文件(根+/ yourDirectoryname);
myDir.mkdirs();档案文件=新的文件(MYDIRyourfilename.txt);
FOS的FileOutputStream =新的FileOutputStream(文件);
ObjectOutputStream的OOS =新的ObjectOutputStream(FOS);
oos.writeObject(对象);
oos.close();
fos.close();
添加此code编写
I'm trying to write a file in my app's android internal storage space. After so many trials, I was finally successful using this method Writing/Reading Files to/from Android phone's internal memory . However, when I go to data/data/package_name/files, I cannot find my package, and cannot even find the MyFile.txt. In fact, I can't find them anywhere in internal memory. Why is that?
String root = Environment.getExternalStorageDirectory().toString();
File f = new File(root + "/yourDirectoryname");
myDir.mkdirs();
File file = new File (myDir, "yourfilename.txt");
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(object);
oos.close();
fos.close();
add this code for writing
这篇关于在内部存储Android文件未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!