android: how to hide folder from appearing in the Gallery

Farhan  picture Farhan · Jul 16, 2011 · Viewed 76.6k times · Source

I have an application that creates a folder in the sd-card. After that, I do several operations which may result in storing different media files, graphics in my folder. The problem is that this folder is then visible in the Gallery section which is not appropriate. How can I hide the folder or the contents of my folder from appearing in the Gallery?

Looking forward for a response Thanks

Answer

CommonsWare picture CommonsWare · Jul 16, 2011

Put a file named .nomedia in the folder. This can be a zero-byte file if you want -- the name is what matters.