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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:59:50+00:00 2026-06-02T23:59:50+00:00

In the class MediaStore.Files class, its mentioned that, Media provider table containing an index

  • 0

In the class MediaStore.Files class, its mentioned that,

Media provider table containing an index of all files in the media storage, including non-media files.

I’m interested in querying for non-media files like PDF.

I’m using CursorLoader to query the database. The second parameter for the constructor requires an Uri argument which is easy to get for the media types Audio, Images and Video as each of them have a EXTERNAL_CONTENT_URI and INTERNAL_CONTENT_URI constant defined for them.

For MediaStore.Files there is no such defined constant. I tried using the getContentUri() method but couldn’t figure out the argument value for volumeName. I tried giving “/mnt/sdcard” and also the volume name that appears when I connect the device to my system but in vain.

I saw a similar question on Google Groups but that is not resolved.

EDIT: I also tried using Uri.fromFile(new File(“/mnt/sdcard/”)) and Uri.parse(new File(“/mnt/sdcard”).toString()) but that didn’t work out either.

  • 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-02T23:59:51+00:00Added an answer on June 2, 2026 at 11:59 pm

    It is "external" or "internal" although internal (system files) is probably not useful here.

    ContentResolver cr = context.getContentResolver();
    Uri uri = MediaStore.Files.getContentUri("external");
    
    // every column, although that is huge waste, you probably need
    // BaseColumns.DATA (the path) only.
    String[] projection = null;
    
    // exclude media files, they would be here also.
    String selection = MediaStore.Files.FileColumns.MEDIA_TYPE + "="
            + MediaStore.Files.FileColumns.MEDIA_TYPE_NONE;
    String[] selectionArgs = null; // there is no ? in selection so null here
    
    String sortOrder = null; // unordered
    Cursor allNonMediaFiles = cr.query(uri, projection, selection, selectionArgs, sortOrder);
    

    If you want .pdf only you could check the mimetype

    // only pdf
    String selectionMimeType = MediaStore.Files.FileColumns.MIME_TYPE + "=?";
    String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension("pdf");
    String[] selectionArgsPdf = new String[]{ mimeType };
    Cursor allPdfFiles = cr.query(uri, projection, selectionMimeType, selectionArgsPdf, sortOrder);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent,CAMERA_PIC_REQUEST); Intent takePictureIntent = new Intent(getParent(),TakePicture.class); takePictureIntent.putExtra(image,thumbnail); OpenBeeActivityGroup opentActivity
Class someInterface = Class.fromName(some.package.SomeInterface); How do I now create a new class that implements
class Achievement(MyBaseModel): parent_achievement = models.ForeignKey('self', blank=True, null=True, help_text=An achievement that must be done before
I have been trying to query for all images on sd card through MediaStore
first post so be nice :) My problem is that I have a class
My app sets the ringtone using the MediaStore class. Everything works fine however I
public class Menus extends Activity { //set constants for MediaStore to query, and show
Activity 2 public class Menus extends Activity { //set constants for MediaStore to query,
I am currently working on an application that lists all the images (thumbnails) on
In my game engine I have a State class that represents the game world

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.