Why is my Android Gallery Full of Nonsense?

Chai Jia Xun
a read

A phone’s gallery app has a fairly straightforward job: display the user’s photos. On the iPhone, this task is quite simple to achieve. The app just needs to list the user’s camera reel as well as photos for any installed photo or messaging apps. Apple having such a controlled environment makes this process easy. Any app that needs to save pictures will have to save it to the gallery app (I presume. I don’t code iPhone apps). This means that there’s only one place to store user generated images. This gets a bit tricky on Android.

Android is essentially a dumbed down personal computer that runs on the linux kernel. It operates on a fully functional filesystem. This has many advantages for users who want an environment that’s more similar to a computer. In fact, that’s how some Android phones have a Desktop environment when plugged into a screen. A user would be able to transfer files directly into the phone and manage those files as one would on a regular desktop or laptop PC. But such freedom makes the lives of developers much harder. Many more considerations have to be made when creating applications, like how file storage is done and how users also have access to those files from separate apps.

Let’s go back to our gallery example. Having Android work on a filesystem means that pictures could be anywhere on a user’s phone. A gallery app could easily just provide a file explorer interface but that isn’t the most convenient way of doing things. A user would expect to see their latest photos when they open the app, not have to navigate the filesystem. To make things convenient, the app could scan the phone for image files. This means the developer would have to make a decision on which folders to scan and which to exclude. This leaves room for error, as can be seen my gallery below.

Now how did this happen?

If we click on the details of one of the photo, we can see that the path of the photo.

We can see that the files are in the /Internal Storage/Android/ folder. I happen to know that this is the folder that (some) apps use to store their cache and temp data. What is happening is that one of my apps (Smart Life) downloaded a bunch of images and stored it in that cache folder. The gallery app scans the phone for new images, then picked up on it and decided it belonged in my photo reel.

The developer, in this case Samsung, should have set some exceptions to the scanning paths and prevented this from happening in the first place. It's not like the Android folder is a custom user folder. Maybe this was a purposeful decision to scan every folder and they decided that it was not worth the effort to come up with a folder blacklist.

For the record, I have seen this happen to Samsung phones running Android Oreo (8) and Android Pie (9). I don’t know if the other manufacturers’ gallery apps are coded any better.

How do we fix this?

Unfortunately for us, I checked the settings and there was no way to set folders to ignore.

Fortunately for us and this post, this is still a fixable problem.

Introducing the .nomedia file.

The .nomedia file is exactly what it looks like, it’s a file with no filename with the extension of nomedia. When it’s placed in a folder, it lets apps know that there is no media content in that folder. All the apps I have used seem to honour this file. From what I understand, this is a file specific to Android and I’m not sure this trick works with other operating systems. Simply putting the .nomedia file in the Android folder should get our gallery to no longer show images from that folder or subfolders.

Short guide

In the screenshots below I’m using ES File Explorer. Most file explorer apps should support this kind of functionality.

Step 1: Check the gallery app to figure out where the file is located by clicking on the overflow menu and Details. (as shown above)

Step 2: Use the file explorer to create a file named “.nomedia” in the folder.

Step 3: Refresh the gallery / wait a bit for the gallery to do the next scan and remove the images from the list. Sometimes the update is instant, but sometimes you’ll have to wait a while for the app to decide to work.

I checked my phone about 5 hours later before it worked.

Other use cases

I have set WhatsApp to automatically download image that people send me. That’s sometimes useful, but I don’t necessarily want all the crap people send me appearing in my gallery. My gallery is reserved for photos or screenshots that I take. So putting the .nomedia file in the phone’s WhatsApp folder will prevent the app from scanning that directory for files.

This also works for other types of media files like audio and videos. For example, if your music player was picking up on an app’s sound effects folder. Simply locate the folder in question and add a .nomedia file. The music app should then stop spamming you with beep1.wav from UNKNOWN ARTIST.

Check the next post: Rift S vs Odyssey for Beat Saber »

Share on:
Chai Jia Xun
Chai Jia Xun

Jia Xun speaks of himself in the third person when writing his bio. He thinks he's being cute but we all know that's just cliche. Being meta is so passe. Why do people still do it?