无法找到存储在设备的内部存储上的文件资源管理器中的文件 [英] Can't find the file stored on Internal Storage of Device on File Explorer

查看:234
本文介绍了无法找到存储在设备的内部存储上的文件资源管理器中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code在应用程序运行在内部存储的文件存储在设备上。

I used the following code to store the file on Internal Storage in Application run on a device.

private void writeToFile(String s){
 try { // catches IOException below
        FileOutputStream fOut = openFileOutput("samplefile.txt",
                                                MODE_WORLD_READABLE);
        OutputStreamWriter osw = new OutputStreamWriter(fOut); 
        osw.write(s);
        osw.flush();
        osw.close();
        FileInputStream fIn = openFileInput("samplefile.txt");
        InputStreamReader isr = new InputStreamReader(fIn);
        char[] inputBuffer = new char[s.length()];
        isr.read(inputBuffer);
        String readString = new String(inputBuffer);
        Log.i("String", readString);

    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
}  

在logcat中显示,该文件被正确写入。但是,试图访问该文件使用FileExplorer在Eclipse中的文件是没有看到在设备上,它应该是(/data/data/your_project_package_structure/files/samplefile.txt)。我发现内部数据文件夹为空。出了什么问题?

The logcat shows that the file is correctly written. But while trying to access the file on the device using FileExplorer on Eclipse the file isn't seen where it should be ("/data/data/your_project_package_structure/files/samplefile.txt"). I find the inner data folder as empty. What went wrong?

我想读该文件,并获取数据饲料用Python编写的其他应用程序。这可能吗?

I want to read that file and get the data to feed another application written in python. Is it possible?

PS:我正在测试的应用程序上的设备,而不是模拟器。

P.S: I am testing the application on a device and not on emulator.

推荐答案

在进一步的研究,我发现,存储在内部存储的文件可以在文件浏览器只能在使用仿真器可以看到。所以看起来像我不得不求助于外部存储。

On further research, I found that the files stored on the internal storage can be seen in file explorer only while using the emulator. So looks like I have to resort to external storage.

这篇关于无法找到存储在设备的内部存储上的文件资源管理器中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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