Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7905923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:41:06+00:00 2026-06-03T10:41:06+00:00

I am using Content Provider to get all the music files in the device

  • 0

I am using Content Provider to get all the music files in the device and display it in the list, however, I now do not want files from a particular folder “X” to appear in my list.

I am using this currently to get all the audio files from SD card.

private static final String[] EXTERNAL_COLUMNS = new String[] {
            MediaStore.Audio.Media._ID, MediaStore.Audio.Media.DATA,
            MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.ARTIST,
            MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.IS_RINGTONE,
            MediaStore.Audio.Media.IS_MUSIC,
            "\"" + MediaStore.Audio.Media.EXTERNAL_CONTENT_URI + "\"" };

private Cursor getExternalAudioCursor(String selection,
            String[] selectionArgs) {
        return managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
                EXTERNAL_COLUMNS, selection, selectionArgs,
                MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
    }

Cursor c = new MergeCursor(new Cursor[] {
            getExternalAudioCursor(selection, argsArray)};

Also from Android docs, I read this…

public static final String MEDIA_IGNORE_FILENAME

Since: API Level 9 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. Constant Value: “.nomedia”

But I cannot be specific about the filenames, because I do not know them before hand.

So my question is can I do something similar with a folder, so that all its content’s do not show up in my List?

If not, then is there any other way I could do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:41:08+00:00Added an answer on June 3, 2026 at 10:41 am

    You could add a .nomedia file to that folder, but that’s not really a programatic solution and you can probably only do that on the SDCARD.

    Unfortunately, that would also prevent other media scanning applications from picking up any files from that folder. If nothing else, you could add it, scan, then delete it. But it’s a really ugly/hacky solution.

    http://lifehacker.com/5793803/disable-media-scanning-in-specific-android-directories-by-creating-a-nomedia-file

    Edit: Apparently, folders that start with a period become hidden to the system. Again, it doesn’t seem like the best idea.

    The premise of temporarily modifying a directory/adding a .nomedia file, scanning, then deleting it doesn’t seem all that evil, but what if your app crashes before you’ve had a chance to reset the files/folders back to their original states? If an application modified my directory and now other applications can no longer function properly (possibly), I would be a rather upset user.

    These solutions seem like they are geared towards consumers/users rather than developers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get call log by using the CallLog.Calls content provider. However,
I'm using SqlCipher with content providers. Right now, when I want to lock the
i'm using div content editable html to get value from input keyboard to post
I have appended content (using ajax) to my document and my events are not
I am struggling to get a list created by Ember.js sortable using jQuery.ui. The
In the starter kit using xpath builder, how do I get all the items
The Get, Edit and Delete all work fine. But add will not call into
I'm currently using JTable to show the contents in database. I want to provide
I am using content_for and yeild to inject javascript files into the bottom of
i am using site content type RichHtmlField as Full HTML type with value =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.