Monday, May 21, 2012

How to hide media files from a folder Android

Sometimes we need to hide the media files from a folder . In order to attain this create a nomedia file on that folder. Name of the file signaling the media scanner to ignore media in the containing directory and its subdirectories. Developers should use this to avoid application graphics showing up in the Gallery and likewise prevent application sounds and music from showing up in the Music app. The media files only get disappererd only when after reboot of that phone.

file= new File(path);
if (!file.exists()){
   try {
      file.createNewFile();
   } catch (IOException e) {
       e.printStackTrace();
   }
}

No comments:

Post a Comment