SEARCH

How-To Geek

Prevent a Media Directory from Appearing in Android Gallery

The Gallery application on Android devices is a bit aggressive about scanning and adding directories. Have a directory you want to keep private? Use this simple trick to keep it out of the Gallery app.

If you want to use the Gallery app to show people pictures of your kid/dog/home remodeling project and not your girlfriend’s chest/drinking exploits/night at the club then this tip is for you. By default Android’s Gallery application is aggressive about adding media. It assumes that if it is on your SD card then you want it in your gallery for easy access. This isn’t always the case and, thankfully, it’s easy to fix. At the computer trips and tricks blog Addictive Tips they share three ways you can prevent Gallery from going crazy and indexing everything on your phone. How do you do this? Like so:

Using any file explorer/manager application (such as Astro File Manager or File Expert), navigate to the directory that you want hidden and create an empty file titled “.nomedia”.

One way to do so is to:

  • Copy an existing text (.txt) or even an image (.jpg/.png) file to said directory,
  • Open it in a text editor (hold down on the file and select the appropriate option from the context menu that appears),
  • Delete its contents (hold down on the text, Select all and Delete), save changes and exit,
  • Rename it to “.nomedia” (hold down on the file again and select Rename from its context menu).

This method disables media scanning on the chosen directory, causing the Gallery to skip the directory altogether at launch.

Restart Gallery and the directory you added the .nomedia file to will no longer appear. For the other two methods, hit up the link below.

How To Prevent a Directory From Being Scanned By Android Gallery [Addictive Tips]

Jason Fitzpatrick is warranty-voiding DIYer and all around geek. When he's not documenting mods and hacks he's doing his best to make sure a generation of college students graduate knowing they should put their pants on one leg at a time and go on to greatness, just like Bruce Dickinson. You can follow him on if you'd like.

  • Published 04/20/11

Comments (5)

  1. Robert

    I did the “.nomedia” trick to block my movies and tv shows (video files) from showing up in the gallery – worked like a charm. The downside? My video player, “Act 1 video” couldn’t see the video files either :o( I had to manually search for them – or open them from Astro.

    I wish there was a way to tag a folder as “view in video player, but not ‘the gallery’.. “

  2. lolcat

    Does it block the contents of subfolders too?
    Thanks for the tip =)

  3. legycsapo

    Also you can password protect your pictures with Vaulty Free Hides Pictures:

    https://market.android.com/details?id=com.theronrogers.vaultyfree&feature=search_result

  4. DroidGeek

    Anybody know if there is a similar trick that is specific to one file type? Like .nopics or .nomusic?

    I have album art in my music directory and every folder for every album shows up in the gallery. It’s EXTREMELY annoying considering the only pics I want to see in the gallery are all in one folder, yet I have to scroll through hundreds to find it. The .nomedia trick worked to keep the music folders from showing up in the gallery app but it also hid the music from ALL apps. Not very helpful after all…

  5. khadersays

    I tried this quite sometime back and it has one serious downside – after a phone restart, all files in the folder with the “.nomedia” file are deleted. I’m not kidding. Backup your files first and try it.

    This ‘feature’ was confirmed on a fully updated HTC Wildfire 2 months back and on several other devices as shared by their owners (google for the forums). Whenever I come across this ‘trick’ I wonder why this warning is not put alongside.

Enter Your Email Here to Get Access for Free:

Go check your email!