Android avoids the disclosure of images and other resources in the system Gallery

Source: Internet
Author: User

Summarize Android to 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 image to. ing suffix

For example Ic_launcher.png instead of ic_launcher.ing


The second Kind

The folder 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 directory you want to hide
Generate the. Nomedia folderThe principle is the SD card, the library will automatically skip the. nomedia file, the scanned image, 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 avoids the disclosure of images and other resources in the system Gallery

Related Article

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.