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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:08:29+00:00 2026-05-23T14:08:29+00:00

I have been trying to fix an issue since yesterday but no luck yet.

  • 0

I have been trying to fix an issue since yesterday but no luck yet. I made a very simple android application to create directory and the application was working fine. The main source code is mentioned here.

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main); 
    //View vi = null;

    File extDir= Environment.getExternalStorageDirectory(); 
    File sddir = new File(extDir+"/test10");  


    if (sddir.mkdirs()) {  
        Toast toast = Toast.makeText(this,  
        "Directory successfully created!",  
               Toast.LENGTH_SHORT);  
    toast.setGravity(Gravity.CENTER, 0, 0);  
    toast.show();  
    }
    else{  
       Log.e(TAG, "Create dir in sdcard failed");  
       Toast toast = Toast.makeText(this,  
       "Directory creation failed!",  
              Toast.LENGTH_SHORT);  
       toast.setGravity(Gravity.CENTER, 0, 0);  
    toast.show();  
   } 
   ..... followed by remaining code 

However, yesterday, when I integrated this code to my own application (a simple videolist that plays videos from the sd-card), the directory function, for whatever reasons, resulted in directory creation failed… I debugged the application but couldn’t find exception errors or other errors in it. I don’t know what could be wrong.. I am just wondering if there is any method to get the error statement behind directory creation failed. I mean if mkdirs failed, it could generate a small print statement about why it got failed??
any suggestions??

  • 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-23T14:08:29+00:00Added an answer on May 23, 2026 at 2:08 pm

    Please try with below function.

    File cacheDir = new File(android.os.Environment.getExternalStorageDirectory(),"test10");
    if (!cacheDir.exists())
        cacheDir.mkdirs();
    

    and declare <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> in manifest file.

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

Sidebar

Related Questions

I have been trying to fix this issue for the past 2-3 hours but
I have been trying to fix this issue for weeks but I'm at the
i have been trying so hard to fix my issue. I've looked on google
I have been trying to fix this for a while but I have had
I have been trying to fix my .setText crash issue, which occures when i
I have been trying desperately to fix this issue where my ListView items are
So, I have been trying to fix this for about two months. It all
I really need some help with this as I have been trying to fix
I am trying to fix a regular expression i have been using in php
I've been trying to fix this issue for a while, I've spent endless amounts

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.