Files created on external storage do not show up when device is mounted on Windows/Mac

为君一笑 提交于 2019-12-13 14:55:13

问题


I have a simple application that attempts to save some data to external storage on Android device (Nexus 4) to be later retrieved on PC (Windows or Mac).

The writing succeeds but when i try to retrieve the file using Android File Transfer on Mac or by Explorer on Windows the MyApp directory just isn't there.

If i use 'Root Explorer' app on the device itself i can see the directory and the file and all permissions look ok.

The application code is along the following lines:

        File extStorageDir = Environment.getExternalStorageDirectory();
        File path = new File(extStorageDir, "MyApp");
        File file = new File(path, "TestFile.txt");

        OutputStream os = new FileOutputStream(file);

            // ... write something

        os.close();

Ideas appreciated.


回答1:


see here

Use the app sd scanner, it seems to work on my Nexus 7 with android kitkat




回答2:


I experienced similar problem with Android 4 and Mac os. I guess that you might be in the same situation. The solution was to rescan the sd storage using SDrescan.

This is described here: Nexus 4 not showing files via MTP



来源:https://stackoverflow.com/questions/18292694/files-created-on-external-storage-do-not-show-up-when-device-is-mounted-on-windo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!