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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:09:04+00:00 2026-05-15T23:09:04+00:00

I see that as of API Level 8, you can request a handle to

  • 0

I see that as of API Level 8, you can request a handle to special directories with Environment.getExternalStoragePublicDirectory(). This takes a type such as DIRECTORY_MUSIC, DIRECTORY_PICTURES, etc.

I’m looking for an equivalent directory for other media types such as documents (Word docs, PDFs, etc.). My HTC Desire has a /sdcard/My Documents/ folder which looks like exactly what I want, but it has no DIRECTORY_ specifier for use with the above method. Is this a standard Android directory which I can rely on?

If I can’t use getExternalStoragePublicDirectory(), I have to use getExternalStorageDirectory() instead which just points me to the root of the SD card. I can explicitly check for the presence of My Documents under the root and use it if it’s there.

This is what I have:

 // default document save location
 File defaultSaveDir = Environment.getExternalStorageDirectory();
 File myDocs         = new File(defaultSaveDir, "My Documents");
 if (myDocs.exists() && myDocs.isDirectory())
     defaultSaveDir = myDocs;

Is there a better way?

  • 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-15T23:09:05+00:00Added an answer on May 15, 2026 at 11:09 pm

    “My Documentes” is not there on my Nexus. Instead I have an “Documents” directory. So that won’t help in a portable way.

    With SDK 8 you should use getExternalFilesDir – but beware there is a catch. I wrote a little article in my Blog.

    In the end I used:

    final java.io.File Storage = android.os.Environment.getExternalStorageDirectory ();
    final java.io.File Dir = new java.io.File (Storage, "Android/FX-603P");
    Dir.mkdirs ();
    

    I used the “Android” base directory as it seem the new preferred way since SDK8.

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

Sidebar

Related Questions

I see that EF can update a model based on an existing database schema.
I see that over on this question LINQy way to check if any objects
I see that tax information is kept at order level but I cannot see
I see that you can enable/disable using the EnableWindow method, but how do I
This seems like it should be fairly straight-forward, but I can't see anything obvious.
I noticed that in Android API Level 11 (ICS) MotionEvent has a transform method
High Level Goal: Create a single Maven Web Application project that can be used
I can see that almost all modern APIs are developed in the C language.
I have looked at the Java API for ReentrantLock and what I can see
I see that $element.is(':animated') tells me if $element is being animated but is it

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.