each time through the output stream to the SD card to write files, connected to the computer, using MTP to simulate a mobile disk, open the disk but there is no such a file, and the way to see through the ADB, the cause of this phenomenon is that after each write, the MTP database is not updated, Because the update of the MTP database requires a large price ratio, so only in the restart, mount and the user manually send intent, so the file needs to be manually sent intent broadcast, set out the MTP database update.
/** * Scan  MTP Under the file, after saving the file to the  SD card, can not display, so here trigger a scanning mechanism, so that the phone connected to the computer, you can read the file * @param fname, the full path name of the file */ public void filescan (String fname) { uri data = uri. parse ("file:///" + FName); sendbroadcast ( new Intent (Intent.action_media_scanner_scan_file , data));
An Android SD card cannot immediately display the file that was written after it was written to the file solution