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

  • Home
  • SEARCH
  • 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 6637937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:22:29+00:00 2026-05-25T23:22:29+00:00

i would like to do a simple operation. Create a file in android, but

  • 0

i would like to do a simple operation. Create a file in android, but i don’t know why. android didn’t create this file. Android stop between debug 2 and debug 3.The folder is not created. I don’t understand why.

try {
File inventoryDir = new File(Environment.getExternalStorageDirectory()+"/ludovic");
String userfile = "/session.txt";
if (!inventoryDir.exists()){
inventoryDir.mkdirs();
Log.i("debug","debug 1");   
}
File userFile = new File(inventoryDir, userfile);
Log.i("debug","file path "+userFile.getAbsolutePath());
                    Log.i("debug","debug 2");           
                    FileWriter fw = new FileWriter(userFile);
                    Log.i("debug","debug 3");
                    BufferedWriter bw = new BufferedWriter(fw);
                    Log.i("debug","debug 4");
                    bw.write("teste d'ecriture");
                    Log.i("debug","debug 5");
                    bw.close();
                    Log.i("debug","debug 6");
                    Log.i("debug","enregistre");
                } catch (IOException e) {
                    Log.i("debug","non enregistre");
                    e.printStackTrace();
                }

i have test this code

    try { // catches IOException below
                    final String TESTSTRING = new String("Hello Android");

                    // ##### Write a file to the disk #####
                    /* We have to use the openFileOutput()-method
                     * the ActivityContext provides, to
                     * protect your file from others and
                     * This is done for security-reasons.
                     * We chose MODE_WORLD_READABLE, because
                     *  we have nothing to hide in our file */             
                    FileOutputStream fOut = openFileOutput("samplefile.txt",
                                                            MODE_WORLD_READABLE);
                    OutputStreamWriter osw = new OutputStreamWriter(fOut); 

                    // Write the string to the file
                    osw.write(TESTSTRING);
                    /* ensure that everything is
                     * really written out and close */
                    osw.flush();
                    osw.close();

Whith this code, i didn’t have problem’s to create file but i don’t find this file if i search with windows explorer.

  • 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-25T23:22:30+00:00Added an answer on May 25, 2026 at 11:22 pm
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="byd.eagle"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>  
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".EagleBackup"
                  android:label="@string/app_name">
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="8" />
    

    Look at this code sample. The location where the uses-permission declared is the key. Just try both in and out the activity!

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

Sidebar

Related Questions

I would like to create a simple file format/DSL which would allow my users
I have a simple operation like so: k + 1 What would be a
i would like a simple help... i have a url like this: example.com/profile.php?id= &
I would like links to be trigger on double click. Something simple like this:
I would like to create simple objects at runtime (textbox, label, etc) and add
I would like to make a simple desktop application to learn this kind of
I would like to create simple C++ calculator using bison and flex. Please note
I am developing a site and i would like some simple markup. I would
I would like to do simple (looping) animation (moving, changing alpha etc) in Haxe
I would like to make a simple web app that displays 20 or so

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.