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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:38:16+00:00 2026-05-22T22:38:16+00:00

I built an android app on android 2.2 , for saving files into the

  • 0

I built an android app on android 2.2, for saving files into the SD card I use the following:

 context.getExternalFilesDir(null).getAbsolutePath();

returning a string like:

 /mnt/sdcard/Android/data/com.hello.example1/files

Now I need to make my app compatible with android 2.1, what method do I need to use to get the external files directory?


public static String sTellMeWhereToSaveMyData(Context context) 
{
        String packageName = context.getPackageName();
        File externalPath = Environment.getExternalStorageDirectory();
        File appFiles = new File(externalPath.getAbsolutePath() + "/Android/data/" + packageName+ "/");

        if (appFiles.exists() && appFiles.isDirectory()) 
        {
            return appFiles.getAbsolutePath();
        }
        else 
        {
            if(appFiles.exists())
            {
                Log.v("File Manager","not exists");
            }
            if (!appFiles.mkdir())
            {
                Log.v("File Manager","Could not create");
            }   
        }
        return appFiles.getAbsolutePath();
}
  • 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-22T22:38:16+00:00Added an answer on May 22, 2026 at 10:38 pm

    You should compose the path yourself:

    String packageName = context.getPackageName();
    File externalPath = Environment.getExternalStorageDirectory();
    File appFiles = new File(externalPath.getAbsolutePath() +
                             "/Android/data/" + packageName + "/files");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built an android app which use Google Map feature. I want my
I have built a test android app and signed it successfully and then sent
1) Our Android app will store data in a built-in SQLite DB. I see
I built my first Android app. It is a Live Wallpaper designed for 2.2.
I have an Android App with a pre-built SQLite DB packaged with it. However,
I adapted this tutorial (http://www.screaming-penguin.com/node/7749) to an Android app I've built to allow for
I have built a java server app and am trying to get my android
Here's the use case: A friend and I are building an Android app and
Related to this question: Use with XMLVM to convert android app to iphone app
I'm building the Android scanning app using zxing library. I have built the zxing

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.