1. Download our Official Android App: Forums for Android!

Apps Problem saving *.TXT file

Discussion in 'Android Development' started by hlustosa, Apr 20, 2011.

  1. hlustosa

    hlustosa Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Apr 20, 2011

    Apr 20, 2011
    1
    0
    5
    I'm a begginer Android Developer, and I'm trying to deploy a simple App which writes a .Txt file on the SDCARD.

    But every time I try to do so, I get this permission denied error message.

    Here's the code:

    File file = new File(Environment.getExternalStorageDirectory(), "test.txt");

    if( file.createNewFile())
    {
    FileWriter fw = new FileWriter(file);
    fw.write(text);
    fw.close();
    }






    I've already added
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">


    to the Manifest, but I still receive this error message. I'm using the eclipse, and the emulator that comes with the SDK. But I was using a Android mobile, and I got the error as well.

    Does anyone know what else should I try. Because I was searching the net, and all I found was people saying to add the permision to the manifest.

    Using android 1.5 on the phone (API level 3). And android 2.2 on the emulator.
     

    Advertisement

  2. JordiDroid

    JordiDroid Member
    Rank:
    None
    Points:
    36
    Posts:
    38
    Joined:
    Apr 20, 2011

    Apr 20, 2011
    38
    2
    36
    Software Engineer
    Netherlands
    That should do the trick. Have you placed the uses-permission tag as a child of the manifest-tag (so not in application or what so ever?)
     

Share This Page

Loading...