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 6760781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:06:19+00:00 2026-05-26T14:06:19+00:00

I want to do a managedQuery using Android SDK where the results returned are

  • 0

I want to do a managedQuery using Android SDK where the results returned are filtered by their respective file extension (e.g. not the name, necessarily). I’ve done quite a bit of researching and am tired and hoping the community can help me.. I’m sure the answer is out there but, in lieu of reading an SQL book or whatever, I’m just trying to do something that should be pretty simple but not finding the solution.

What I want to do is, essentially, something like:

managedQuery(Audio.Media.EXTERNAL_CONTENT_URI, myProjection, Audio.Media.DATA + " like ? ", new String[] {"%mp3%"}, null );

This works EXCEPT that, if the title is something like “mymp3.wav”, this query will still return it since ‘mp3’ is in the name but, that isn’t what I want -> I want it filtered purely based on file extension (or, alternatively, file type if there is a way to do that [e.g. if an mp3’s file extension name was changed to .wav even though the content of the file is actually mp3, that would work for my purposes as well]). The solution should indicate a way to filter for multiple extensions/file types (i.e. if I want the query to return all .mp3 files as well as .wav files but not .amr files, for example).

Furthermore, while I have you, I want to sort the results alphabetically. I have tried something like:

managedQuery(Audio.Media.EXTERNAL_CONTENT_URI, myProjection, null, null, MediaStore.Audio.Media.TITLE + " ASC" );

However, that doesn’t filter the entire results… that is to say that, the list returned is sorted by, say, mp3 title and then, at the end, it then appends to the list the .wav files also sorted alphabetically but I want the entire list to be alphabetical regardless of file type.

I know someone on here can answer this easily -> thanks in advance!!!

  • 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-05-26T14:06:20+00:00Added an answer on May 26, 2026 at 2:06 pm

    I think all you have to do is change %mp3% to %mp3. This will force “mp3” to be at the end of the filename.

    If you need to select multiple file types, do it like this:

    managedQuery(
      Audio.Media.EXTERNAL_CONTENT_URI,
      myProjection, 
      Audio.Media.DATA + " like ? OR " + Audio.Media.DATA + " like ? ", 
      new String[] {"%mp3","%wav"}, 
      MediaStore.Audio.Media.TITLE + " ASC" );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

want to know why String behaves like value type while using ==. String s1
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
want to ask user to input something but not want to wait forever. There
Want to create an alarm application, that will play a music file at a
I want to set the Image to be Selected from the Android Gallery. I
I am trying to get the history and search results from the android browser.
Want to create web sites with data on Dynamics AX. We want not to
What I want: I want to add calendar events in Android 2.2. What I
In my android app I have a gridview that I want to show images
I want the Name of the Contact which includes (FAMILY_NAME, GIVEN_NAME,MIDDLE_NAME,PHONETIC_FAMILY_NAME,PHONETIC_GIVEN_NAME,PHONETIC_MIDDLE_NAME,PREFIX,SUFFIX). I know that

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.