I'm developing an app. The app reads and writes files on SD card. But I have got some inconvinience. If the app writes the file on SD card I want to see it via Windows 7x64 file manager (any file manager: Explorer or Total Commander). The files are not shown until I reconnect the device (directly pull out and insert a wire to USB port). The files are shown as is in any file manager on Android. The device - Samsung Galaxy S3 Is it possible to fix this bug?
Asked
Active
Viewed 2,102 times
1 Answers
1
Try with this
MediaScannerConnection.scanFile (this, new String[] {file.toString()}, null, null);

Josef
- 2,648
- 5
- 37
- 73
-
Where I have to write this code? Directly after writing the files in the app? – Vyacheslav Jun 27 '14 at 06:07
-
Yes, after creating file. – Josef Jun 27 '14 at 06:14
-
Thanks a lot. It works. Anyway using your help I've found more complicated solutions. But your is the simplest. Here the link for future generations of programmers:) http://stackoverflow.com/questions/4646913/android-how-to-use-mediascannerconnection-scanfile – Vyacheslav Jun 27 '14 at 06:36
-
How to update deleted files? If I open the folder with deleted files the Explore in windows at first time shows this (deleted) files, then Explorer crashes:) – Vyacheslav Jun 27 '14 at 16:43
-
Hm... never thought about that.. I found one solution that might help you but I had no chance to test it so try to implement this in your project and let see. Here is the link http://pastebin.com/eN36uinC – Josef Jun 27 '14 at 17:02
-
The link above( http://stackoverflow.com/questions/4646913/android-how-to-use-mediascannerconnection-scanfile ) I read %%sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));%% doesn't work for newest Android versions (>4.4) – Vyacheslav Jun 27 '14 at 19:46