问题
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