无法看到在Windows资源管理器中的文件,而它在Android的文件浏览器中可见器中、文件、它在、资源管理

2023-09-07 16:37:51 作者:在等月亮和你

通过我的Andr​​oid程序我写了一个文件是这样的:

Through my Android program I wrote a file like this:

String file = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Files/hello.txt";
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(str+"\n");     \\yeah string has a value there
writer.close();

现在,当我去到Android的天文文件浏览器,我可以看到文件hello.txt的到/ mnt / SD卡/文件但是当我安装在SD卡Windows中,我只看到其中4人有该文件夹中的其他文件而不是hello.txt的。

Now when I go to Android's "Astro" File browser, I can see the file hello.txt in /mnt/sdcard/Files but when I mount the sdcard in Windows, I can only see 4 other files which were there in that folder but not hello.txt.

在Windows本身,我甚至试图取消隐藏隐藏文件选项只是为了确保该文件没有隐藏,但它只是不可见。

In Windows itself, I even tried to uncheck the hide hidden files option just to ensure that the file is not hidden but it's just not visible.

我甚至试着写在文件中的SD卡根却又同样的问题。现在,我很惊讶,怎么可能,我可以看到在Android中,但不是在Windows中的文件。在Android中我甚至检查文件内容,一切都看起来很好。

I even tried to write the file in root of the sdcard but again same problem. Now I'm surprised that how is it possible that I can see the file in Android but not in Windows. In Android I've even checked the file contents and everything looks fine.

这可能是什么问题呢?是我写的文件错了的方式呢?

What could be the problem? Is the way I'm writing the file wrong?

PS:是的,舱单权限 android.permission.WRITE_EXTERNAL_STORAG​​E 添加

PS: yes the Manifest permission android.permission.WRITE_EXTERNAL_STORAGE is added.

推荐答案

好吧,我想通了,为什么发生。其实即使我们preSS返回按钮,程序继续运行,除非我去设置>应用>管理应用程序> 强制停止<应用> 我无法访问由哪怕是SD卡上,即使FileWriter的已经关闭这个程序写入的文件。

Ok, I figured out why it was happening. Actually even if we press "Back" button, the program keeps running and unless I go to Settings > Applications > Manage Applications > "Force Stop" <application> I can't access the file written by this program even if it is on sd card and even if the filewriter has been closed.

这只是基于我的观察,我想有人张贴用事实和解决方案,更好的答案。

This is just based on my observation and I'd like someone to post a better answer with facts and with solution.

编辑:我会相应地更新我的问题。

edit: I'll update my question accordingly.

修改:建议对元我已经发布了一个新的问题

edit: as recommended on meta I've posted a new question

Can't看到SD卡上写的Andr​​oid应用程序在Windows中的文件,除非我强制关闭的应用