Summarize Android nomedia Avoid file leaks in System gallery and system ringtones
Images of projects in application development are always included in the system's Gallery
There are 2 ways to avoid images that are included in the System gallery
The first one for the picture
Rename the. png suffix to the. ing suffix
Like Ic_launcher.png instead of ic_launcher.ing.
Another kind
The directory where the project holds the picture is written
/.nomedia
File Nomedia = new file (FilePath + "/.nomedia"); if (! nomedia.exists ())) try { nomedia.createnewfile (); } catch (Exception e) { e.printstacktrace (); }
FilePath for the folder you want to hide
Generate the. Nomedia directoryThe principle is that the SD card, the library will actively skip the. nomedia file, the scanned pictures, ringtones and other multimedia files Media_type set to 0remark:media_type value 0: Normal file, 1: Picture file, 2: Audio file, 3: Video file). and the library shows the file is (Media_type = 1 or media_type = 3
My references:http://blog.csdn.net/wqhjfree/article/details/8089591
http://blog.sina.com.cn/s/blog_832a912401014gfw.html
Android Nomedia Avoid leaking pictures and other resources in the system gallery where