Android: Files that I write to the sdcard do not show in Windows explorer, for Acer Iconiatab

android

In my application, I create files and write them to the Sdcard. My created files show properly in DDMS, and in windows explorer when I mount my Samsung Galaxy as a USB device. But, they do not show in Windows explorer on my Acer Iconia Tab A500, when it is connected by USB. I assume this is due to some difference in 3.0? Do I need to create my files differently in 3.0 so that they show in Windows by usb?

Best Answer

Sending this intent after writing the file solved the issue. Credit goes to Commons Guy, he provided the answer on another forum.

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"
            + Environment.getExternalStorageDirectory()))); 

Edit: Commons Guy did comment that sending a fake intent (like above) is probably a bad idea, so I used this instead:

   //called after writing file, from my activity 
    new SingleMediaScanner(this, path); 

    private class SingleMediaScanner implements MediaScannerConnectionClient 
    { 
            private MediaScannerConnection mMs; 
            private String path; 
            SingleMediaScanner(Context context, String f) 
            { 
                mPath = f; 
                mMs = new MediaScannerConnection(context, this); 
                mMs.connect(); 
            } 
            @Override 
            public void onMediaScannerConnected() 
            { 
                mMs.scanFile(mFile, null); 
            } 
            @Override 
            public void onScanCompleted(String path, Uri uri) 
            { 
                mMs.disconnect(); 
            } 
        }