Android Nomedia Avoid leaking pictures and other resources in the system gallery where

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.