- Forum posts: 13
Apr 18, 2016, 7:25:10 AM via Website
Apr 18, 2016 7:25:10 AM via Website
I'm using a USB connection to copy files from my Android phone to my PC, that are saved with this app I'm making. I found a workaround for when files aren't appearing. I just do:
M
ediaScannerConnection.scanFile(this, new String[]{MyFile.getAbsolutePath()}, null, null);
and then the file appears.
However I'm having much more trouble getting DIRECTORIES to appear over USB. When I use MyDirectory.mkdirs() to make a directory based on a complete path, and then follow that up with this code to try to force it to be visible:
M
ediaScannerConnection.scanFile(this, new String[]{MyDirectory.getAbsolutePath()}, null, null);
it does become visible over the USB connection on my PC, but it does NOT appear as a directory. Instead it appears as an extensionless file. I have searched long and hard all over the net, for about an hour, trying to find a solution to this problem, but it seems that nobody else has experienced this exact problem (or else my Googling skills aren't good enough, or else my Android programming skills are really bad).
Giving up hope of finding a solution elsewhere, I have turned to this fourm. I hope somebody here can provide me with an answer.
— modified on Apr 18, 2016, 7:26:33 AM
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.